diff --git a/modules/hydrodyn/CMakeLists.txt b/modules/hydrodyn/CMakeLists.txt
index 7b9a59f9f9..7ef738647b 100644
--- a/modules/hydrodyn/CMakeLists.txt
+++ b/modules/hydrodyn/CMakeLists.txt
@@ -68,9 +68,6 @@ if(APPLE OR UNIX)
endif()
-#add_executable(ss_radiation
-# src/SS_Radiation_DriverCode.f90)
-#target_link_libraries(ss_radiation hydrodynlib nwtclibs)
install(TARGETS hydrodynlib hydrodyn_driver hydrodyn_driver_subs hydrodyn_c_binding
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
diff --git a/modules/hydrodyn/src/Conv_Radiation.f90 b/modules/hydrodyn/src/Conv_Radiation.f90
index ed3a595f4b..59842ddd2c 100644
--- a/modules/hydrodyn/src/Conv_Radiation.f90
+++ b/modules/hydrodyn/src/Conv_Radiation.f90
@@ -340,7 +340,7 @@ SUBROUTINE Conv_Rdtn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, InitOut, E
m%LastIndRdtn = 0
OtherState%IndRdtn = 0
- ! bjj: these initializations don't matter, but I don't like seeing the compilation warning in IVF:
+ ! bjj: these initializations don't matter, but I don't like seeing the compilation warning in Intel Fortran:
x%DummyContState = 0.0
z%DummyConstrState = 0.0
y%F_Rdtn = 0.0
@@ -632,7 +632,6 @@ SUBROUTINE Conv_Rdtn_UpdateDiscState( Time, n, u, p, x, xd, z, OtherState, m, Er
! with the newest values:
! NOTE: When IndRdtn > LastIndRdtn, IndRdtn will equal LastIndRdtn + 1 if DT <= RdtnDT;
! When IndRdtn > LastIndRdtn, IndRdtn will be greater than LastIndRdtn + 1 if DT > RdtnDT.
- !BJJ: this needs a better check so that it is ALWAYS done (MATLAB/Simulink could possibly avoid this step by starting at Time>0, OR there may be some numerical issues where this is NOT EXACTLY zero)
IF ( OtherState%IndRdtn < (p%NStepRdtn) ) THEN
DO J = 1,6*p%NBody ! Loop through all platform DOFs
diff --git a/modules/hydrodyn/src/HydroDyn.f90 b/modules/hydrodyn/src/HydroDyn.f90
index 3aedc321d5..459277e42c 100644
--- a/modules/hydrodyn/src/HydroDyn.f90
+++ b/modules/hydrodyn/src/HydroDyn.f90
@@ -142,12 +142,10 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
ErrStat = ErrID_None
ErrMsg = ""
- p%UnOutFile = -1 !bjj: this was being written to the screen when I had an error in my HD input file, so I'm going to initialize here.
- p%PointsToSeaState = .true. ! this should be true unless we are initializing from restart (in a different driver/routine)
+ p%UnOutFile = -1
-#ifdef BETA_BUILD
- CALL DispBetaNotice( "This is a beta version of HydroDyn and is for testing purposes only."//NewLine//"This version includes user waves, WaveMod=6 and the ability to write example user waves." )
-#endif
+ p%WaveField => InitInp%WaveField
+
! Initialize the NWTC Subroutine Library
@@ -188,10 +186,11 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
RETURN
END IF
- InputFileData%Morison%WtrDens = InitInp%WtrDens
- InputFileData%Morison%WtrDpth = InitInp%WtrDpth
- InputFileData%Morison%MSL2SWL = InitInp%MSL2SWL
-
+
+ InputFileData%Morison%WaveField => InitInp%WaveField
+ InputFileData%WAMIT%WaveField => InitInp%WaveField
+ InputFileData%WAMIT2%WaveField => InitInp%WaveField
+
! Verify all the necessary initialization data. Do this at the HydroDynInput module-level
@@ -269,28 +268,18 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
! Now call each sub-module's *_Init subroutine
! to fully initialize each sub-module based on the necessary initialization data
-
-
- ! Copy Waves initialization output into the initialization input type for the WAMIT module
- !p%NWaveElev = InputFileData%Waves%NWaveElev
- p%NStepWave = InitInp%NStepWave
-
- p%WaveTime => InitInp%WaveField%WaveTime
-
- m%LastIndWave = 1
-
! Is there a WAMIT body?
IF ( InputFileData%PotMod == 1 ) THEN
+ InputFileData%WAMIT%WaveField => InitInp%WaveField
+
p%nWAMITObj = InputFileData%nWAMITObj ! All the data for the various WAMIT bodies are stored in a single WAMIT file
p%vecMultiplier = InputFileData%vecMultiplier ! Multiply all vectors and matrices row/column lengths by NBody
InputFileData%WAMIT%NBodyMod = InputFileData%NBodyMod
InputFileData%WAMIT%Gravity = InitInp%Gravity
- InputFileData%WAMIT%WtrDpth = InputFileData%Morison%WtrDpth ! The data in InputFileData%Morison%WtrDpth was directly placed there when we parsed the HydroDyn input file
p%NBody = InputFileData%NBody
p%NBodyMod = InputFileData%NBodyMod
- InputFileData%WAMIT%WaveElev1 => InitInp%WaveField%WaveElev1
call AllocAry( m%F_PtfmAdd, 6*InputFileData%NBody, "m%F_PtfmAdd", ErrStat2, ErrMsg2 ); call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
call AllocAry( m%F_Waves , 6*InputFileData%NBody, "m%F_Waves" , ErrStat2, ErrMsg2 ); call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
@@ -356,31 +345,7 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
return
end if
- ! Copy SeaState initialization output into the initialization input type for the WAMIT module
-
- InputFileData%WAMIT%RhoXg = InitInp%RhoXg
- InputFileData%WAMIT%NStepWave = InitInp%NStepWave
- InputFileData%WAMIT%NStepWave2 = InitInp%NStepWave2
- InputFileData%WAMIT%WaveDirMin = InitInp%WaveDirMin
- InputFileData%WAMIT%WaveDirMax = InitInp%WaveDirMax
- InputFileData%WAMIT%WaveDOmega = InitInp%WaveDOmega
-
- ! Init inputs for the SS_Excitation model (set this just in case it will be used)
- InputFileData%WAMIT%WaveDir = InitInp%WaveDir
- ! CALL MOVE_ALLOC( InitInp%WaveElev0, InputFileData%WAMIT%WaveElev0 )
- ! CALL MOVE_ALLOC( InitInp%WaveElevC, InputFileData%WAMIT%WaveElevC )
- ! Temporarily move arrays to init input for WAMIT (save some space)
-
- InputFileData%WAMIT%WaveTime => InitInp%WaveField%WaveTime
- InputFileData%WAMIT%WaveElev0 => InitInp%WaveField%WaveElev0
- InputFileData%WAMIT%WaveElevC => InitInp%WaveField%WaveElevC
- InputFileData%WAMIT%WaveElevC0 => InitInp%WaveField%WaveElevC0
- InputFileData%WAMIT%WaveDirArr => InitInp%WaveField%WaveDirArr
-
- ! InputFileData%WAMIT%seast_interp_p = InitInp%WaveField%seast_interp_p
- CALL SeaSt_Interp_CopyParam(InitInp%WaveField%seast_interp_p, InputFileData%WAMIT%seast_interp_p, MESH_NEWCOPY, ErrStat2, ErrMsg2)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
-
+
CALL WAMIT_Init(InputFileData%WAMIT, m%u_WAMIT(1), p%WAMIT(1), x%WAMIT(1), xd%WAMIT(1), z%WAMIT, OtherState%WAMIT(1), &
y%WAMIT(1), m%WAMIT(1), Interval, ErrStat2, ErrMsg2 )
CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
@@ -427,7 +392,7 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
WRITE( InputFileData%UnSum, '(A81)' ) 'Buoyancy loads from members modelled with WAMIT, summed about ( 0.0, 0.0, 0.0 )'
WRITE( InputFileData%UnSum, '(18x,6(2X,A20))' ) ' BuoyFxi ', ' BuoyFyi ', ' BuoyFzi ', ' BuoyMxi ', ' BuoyMyi ', ' BuoyMzi '
WRITE( InputFileData%UnSum, '(18x,6(2X,A20))' ) ' (N) ', ' (N) ', ' (N) ', ' (N-m) ', ' (N-m) ', ' (N-m) '
- WRITE( InputFileData%UnSum, '(A18,6(2X,ES20.6))') ' External: ',0.0,0.0,InputFileData%WAMIT%RhoXg*InputFileData%PtfmVol0(iBody),InputFileData%WAMIT%RhoXg*InputFileData%PtfmVol0(iBody)*InputFileData%PtfmCOByt(iBody), -InputFileData%WAMIT%RhoXg*InputFileData%PtfmVol0(iBody)*InputFileData%PtfmCOBxt(iBody), 0.0 ! and the moment about Y due to the COB being offset from the WAMIT reference point
+ WRITE( InputFileData%UnSum, '(A18,6(2X,ES20.6))') ' External: ',0.0,0.0,p%WaveField%RhoXg*InputFileData%PtfmVol0(iBody),p%WaveField%RhoXg*InputFileData%PtfmVol0(iBody)*InputFileData%PtfmCOByt(iBody), -p%WaveField%RhoXg*InputFileData%PtfmVol0(iBody)*InputFileData%PtfmCOBxt(iBody), 0.0 ! and the moment about Y due to the COB being offset from the WAMIT reference point
end do
END IF
@@ -442,20 +407,8 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
! Flag required for indicating when to try using arrays that are allocated
p%WAMIT2used = .TRUE.
- ! init input for WAMIT2 pointers to save space
- !InputFileData%WAMIT2%WaveTime => InitInp%WaveTime ! This isn't actually used within WAMIT2 GJH 9/30/2021
- InputFileData%WAMIT2%WaveElevC0 => InitInp%WaveField%WaveElevC0
- InputFileData%WAMIT2%WaveDirArr => InitInp%WaveField%WaveDirArr
-
! Copy Waves initialization output into the initialization input type for the WAMIT module
- InputFileData%WAMIT2%RhoXg = InitInp%RhoXg
- InputFileData%WAMIT2%NStepWave = InitInp%NStepWave
- InputFileData%WAMIT2%NStepWave2 = InitInp%NStepWave2
- InputFileData%WAMIT2%WaveDirMin = InitInp%WaveDirMin
- InputFileData%WAMIT2%WaveDirMax = InitInp%WaveDirMax
- InputFileData%WAMIT2%WaveDOmega = InitInp%WaveDOmega
InputFileData%WAMIT2%Gravity = InitInp%Gravity
- InputFileData%WAMIT2%WtrDpth = InputFileData%Morison%WtrDpth ! The data in InputFileData%Morison%WtrDpth was directly placed there when we parsed the HydroDyn input file
! Set values for all NBodyMods
InputFileData%WAMIT2%NBodyMod = InputFileData%NBodyMod ! There are restrictions in WAMIT2 on which files may be used for MnDriftF or NewmanAppF for BodyMod > 1
@@ -543,14 +496,14 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
! General
FITInitData%InputFile = InputFileData%PotFile
FITInitData%Gravity = InputFileData%Gravity
- FITInitData%Rho = InputFileData%Morison%WtrDens
+ FITInitData%Rho = p%WaveField%WtrDens
FITInitData%time_end = InitInp%TMax
FITInitData%dtime = InitInp%WaveDT ! Set the FIT module's timestep equal to the WaveDT timestep, this was checked earlier to make sure it is an integer muliple of the glue-code timestep!
! Waves
! Need to pre-process the incoming wave data to be compatible with FIT
- FITInitData%N_omega = InitInp%NStepWave2
- FITInitData%Wave_angle = InitInp%WaveDir
+ FITInitData%N_omega = p%WaveField%NStepWave2
+ FITInitData%Wave_angle = p%WaveField%WaveDir
! allocate waves data arrays for FIT
CALL AllocAry( FITInitData%Wave_amp, FITInitData%N_omega, "Wave_amp", ErrStat2, ErrMsg2 )
@@ -567,14 +520,14 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
END IF
! Populate wave arrays (Need to double chech this part. It doesn't look right!)
- Np = 2*(InitInp%WaveDOmega + 1)
- DO I = 1 , InitInp%NStepWave2
+ Np = 2*(p%WaveField%WaveDOmega + 1)
+ DO I = 1 , p%WaveField%NStepWave2
- dftreal = InitInp%WaveField%WaveElevC0( 1, ABS(I ) )
- dftimag = InitInp%WaveField%WaveElevC0( 2, ABS(I ) )*SIGN(1,I)
+ dftreal = p%WaveField%WaveElevC0( 1, ABS(I ) )
+ dftimag = p%WaveField%WaveElevC0( 2, ABS(I ) )*SIGN(1,I)
FITInitData%Wave_amp (I) = sqrt( dftreal**2 + dftimag**2 ) * 2.0 / Np
- FITInitData%Wave_omega (I) = I*InitInp%WaveDOmega
- FITInitData%Wave_number(I) = I*InitInp%WaveDOmega**2. / InputFileData%Gravity
+ FITInitData%Wave_omega (I) = I*p%WaveField%WaveDOmega
+ FITInitData%Wave_number(I) = I*p%WaveField%WaveDOmega**2. / InputFileData%Gravity
FITInitData%Wave_phase (I) = atan2( dftimag, dftreal )
END DO
@@ -593,12 +546,6 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
! Are there Morison elements?
IF ( InputFileData%Morison%NMembers > 0 ) THEN
- ! Copy SeaState initialization output into the initialization input type for the Morison module
- InputFileData%Morison%NStepWave = InitInp%NStepWave
- InputFileData%Morison%MCFD = InitInp%MCFD
- InputFileData%Morison%WaveStMod = InitInp%WaveStMod
- InputFileData%Morison%WaveField => InitInp%WaveField
-
! Were visualization meshes requested?
InputFileData%Morison%VisMeshes = p%VisMeshes
@@ -850,7 +797,6 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I
p%OutFmt = InputFileData%OutFmt
p%OutSFmt = InputFileData%OutSFmt
p%NumOuts = InputFileData%NumOuts
- p%WtrDpth = InputFileData%Morison%WtrDpth
CALL HDOUT_Init( HydroDyn_ProgDesc, InitInp%OutRootName, InputFileData, y, p, m, InitOut, ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
@@ -952,8 +898,6 @@ SUBROUTINE HydroDyn_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
! Destroy the parameter data: (ignore errors)
- ! Need to nullify pointers so that SeaState module data is not deallocated by HD (i.e., use DEALLOCATEpointers=.false. when it points to SeaState data)
- ! on restart, the data is a separate copy of the SeaState module data, hence the PointsToSeaState parameter
CALL HydroDyn_DestroyParam( p, ErrStat2, ErrMsg2 )
@@ -1303,7 +1247,7 @@ SUBROUTINE HydroDyn_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat,
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDyn_CalcOutput' )
if ( ErrStat >= AbortErrLev ) return
- call WAMIT_CalcOutput( Time, p%WaveTime, m%u_WAMIT(1), p%WAMIT(1), x%WAMIT(1), xd%WAMIT(1), &
+ call WAMIT_CalcOutput( Time, m%u_WAMIT(1), p%WAMIT(1), x%WAMIT(1), xd%WAMIT(1), &
z%WAMIT, OtherState%WAMIT(1), y%WAMIT(1), m%WAMIT(1), ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDyn_CalcOutput' )
do iBody=1,p%NBody
@@ -1324,7 +1268,7 @@ SUBROUTINE HydroDyn_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat,
m%u_WAMIT(iBody)%Mesh%TranslationAcc (:,1) = u%WAMITMesh%TranslationAcc (:,iBody)
m%u_WAMIT(iBody)%Mesh%RotationAcc (:,1) = u%WAMITMesh%RotationAcc (:,iBody)
- call WAMIT_CalcOutput( Time, p%WaveTime, m%u_WAMIT(iBody), p%WAMIT(iBody), x%WAMIT(iBody), xd%WAMIT(iBody), &
+ call WAMIT_CalcOutput( Time, m%u_WAMIT(iBody), p%WAMIT(iBody), x%WAMIT(iBody), xd%WAMIT(iBody), &
z%WAMIT, OtherState%WAMIT(iBody), y%WAMIT(iBody), m%WAMIT(iBody), ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDyn_CalcOutput' )
y%WAMITMesh%Force (:,iBody) = y%WAMITMesh%Force (:,iBody) + y%WAMIT(iBody)%Mesh%Force (:,1)
@@ -1345,7 +1289,7 @@ SUBROUTINE HydroDyn_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat,
if (p%WAMIT2used) then
if ( p%NBodyMod == 1 .or. p%NBody == 1 ) then
- call WAMIT2_CalcOutput( Time, p%WaveTime, p%WAMIT2(1), y%WAMIT2(1), m%WAMIT2(1), ErrStat2, ErrMsg2 )
+ call WAMIT2_CalcOutput( Time, p%WaveField, p%WAMIT2(1), y%WAMIT2(1), m%WAMIT2(1), ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDyn_CalcOutput' )
do iBody=1,p%NBody
y%WAMITMesh%Force (:,iBody) = y%WAMITMesh%Force (:,iBody) + y%WAMIT2(1)%Mesh%Force (:,iBody)
@@ -1356,7 +1300,7 @@ SUBROUTINE HydroDyn_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat,
else
do iBody=1,p%NBody
- call WAMIT2_CalcOutput( Time, p%WaveTime, p%WAMIT2(iBody), y%WAMIT2(iBody), m%WAMIT2(iBody), ErrStat2, ErrMsg2 )
+ call WAMIT2_CalcOutput( Time, p%WaveField, p%WAMIT2(iBody), y%WAMIT2(iBody), m%WAMIT2(iBody), ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDyn_CalcOutput' )
y%WAMITMesh%Force (:,iBody) = y%WAMITMesh%Force (:,iBody) + y%WAMIT2(iBody)%Mesh%Force (:,1)
y%WAMITMesh%Moment(:,iBody) = y%WAMITMesh%Moment(:,iBody) + y%WAMIT2(iBody)%Mesh%Moment(:,1)
@@ -2451,7 +2395,7 @@ SUBROUTINE HD_Init_Jacobian( p, u, y, InitOut, ErrStat, ErrMsg)
if (ErrStat >= AbortErrLev) return
- perturb_t = 0.02_ReKi*D2R * max(p%WtrDpth,1.0_ReKi) ! translation input scaling
+ perturb_t = 0.02_ReKi*D2R * max(p%WaveField%EffWtrDpth,1.0_ReKi) ! translation input scaling
perturb = 2*D2R ! rotational input scaling
index = 0
@@ -2829,7 +2773,7 @@ SUBROUTINE HD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op,
call PackMotionMesh(u%PRPMesh, u_op, index, FieldMask=Mask)
! extended input:
- u_op(index) = 0.0_R8Ki !u%WaveElev0
+ u_op(index) = 0.0_R8Ki
END IF
diff --git a/modules/hydrodyn/src/HydroDyn.txt b/modules/hydrodyn/src/HydroDyn.txt
index 7404e94a7e..7d2b9c0766 100644
--- a/modules/hydrodyn/src/HydroDyn.txt
+++ b/modules/hydrodyn/src/HydroDyn.txt
@@ -35,7 +35,6 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi AddCLin {:}{:}{:} - - "Additional stiffness matrix" -
typedef ^ ^ ReKi AddBLin {:}{:}{:} - - "Additional linear damping matrix" -
typedef ^ ^ ReKi AddBQuad {:}{:}{:} - - "Additional quadratic damping (drag) matrix" -
-typedef ^ ^ SeaSt_InitInputType SeaState - - - "Initialization data for SeaState module" -
typedef ^ ^ CHARACTER(1024) PotFile {:} - - "The name of the root potential flow file (without extension for WAMIT, complete name for FIT)" -
typedef ^ ^ INTEGER nWAMITObj - - - "number of WAMIT input files. If NBodyMod = 1 then nPotFiles will be 1 even if NBody > 1" -
typedef ^ ^ INTEGER vecMultiplier - - - "multiplier for the WAMIT vectors and matrices. If NBodyMod=1 then this = NBody, else 1" -
@@ -72,36 +71,11 @@ typedef ^ ^ FileInfoTyp
typedef ^ ^ CHARACTER(1024) OutRootName - - - "Supplied by Driver: The name of the root file (without extension) including the full path" -
typedef ^ ^ Logical Linearize - .FALSE. - "Flag that tells this module if the glue code wants to linearize." -
typedef ^ ^ ReKi Gravity - - - "Supplied by Driver: Gravitational acceleration" "(m/s^2)"
-typedef ^ ^ ReKi WtrDens - - - "Water density from the driver; may be overwritten " "(kg/m^3)"
-typedef ^ ^ ReKi WtrDpth - - - "Water depth from the driver; may be overwritten " "m"
-typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level from the driver; may be overwritten" "m"
typedef ^ ^ DbKi TMax - - - "Supplied by Driver: The total simulation time" "(sec)"
-typedef ^ ^ ReKi PtfmLocationX - - - "Supplied by Driver: X coordinate of platform location in the wave field" "m"
-typedef ^ ^ ReKi PtfmLocationY - - - "Supplied by Driver: Y coordinate of platform location in the wave field" "m"
typedef ^ ^ logical VisMeshes - .false. - "Output visualization meshes" -
#
-typedef ^ ^ INTEGER NStepWave - 0 - "Total number of frequency components = total number of time steps in the incident wave" -
-typedef ^ ^ INTEGER NStepWave2 - 0 - "NStepWave / 2" -
-typedef ^ ^ SiKi RhoXg - - - "= WtrDens*Gravity" -
-typedef ^ ^ INTEGER WaveMod - - - "Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED }" -
-typedef ^ ^ INTEGER WaveStMod - - - "Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching}" -
-typedef ^ ^ INTEGER WaveDirMod - - - "Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6]" -
-typedef ^ ^ SiKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ LOGICAL InvalidWithSSExctn - - - "Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2)" (-)
-typedef ^ ^ SiKi WaveElev0 {:} - - "Instantaneous elevation time-series of incident waves at the platform reference point" (meters)
-typedef ^ ^ SiKi WaveElevC {:}{:}{:} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (meters)
-typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction." (degrees)
-typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction." (degrees)
-typedef ^ ^ SiKi WaveDir - - - "Incident wave propagation heading direction" (degrees)
-typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
-typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
-typedef ^ ^ SiKi MCFD - - - "Diameter of MacCamy-Fuchs members" (meters)
-typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
+typedef ^ ^ LOGICAL InvalidWithSSExctn - - - "Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2)" (-)
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
#
#
# Define outputs from the initialization routine here:
@@ -151,7 +125,6 @@ typedef ^ MiscVarType MeshType
typedef ^ ^ HD_ModuleMapType HD_MeshMap - - -
typedef ^ ^ INTEGER Decimate - - - "The output decimation counter" -
typedef ^ ^ DbKi LastOutTime - - - "Last time step which was written to the output file (sec)" -
-typedef ^ ^ INTEGER LastIndWave - - - "The last index used in the wave kinematics arrays, used to optimize interpolation" -
typedef ^ ^ ReKi F_PtfmAdd {:} - - "The total forces and moments due to additional pre-load, stiffness, and damping" -
typedef ^ ^ ReKi F_Hydro {6} - - "The total hydrodynamic forces and moments integrated about the (0,0,0) platform reference point" -
typedef ^ ^ ReKi F_Waves {:} - - "The total waves forces on a WAMIT body calculated by first and second order methods (WAMIT and WAMIT2 modules)" -
@@ -175,9 +148,6 @@ typedef ^ ^ INTEGER
typedef ^ ^ INTEGER totalStates - - - "Number of excitation and radiation states for all WAMIT bodies" -
typedef ^ ^ INTEGER totalExctnStates - - - "Number of excitation states for all WAMIT bodies" -
typedef ^ ^ INTEGER totalRdtnStates - - - "Number of radiation states for all WAMIT bodies" -
-typedef ^ ^ SiKi WaveTime {*} - - "Array of time samples, (sec)" -
-typedef ^ ^ INTEGER NStepWave - - - "Number of data points in the wave kinematics arrays" -
-typedef ^ ^ ReKi WtrDpth - - - "Water depth" (m)
typedef ^ ^ ReKi AddF0 {:}{:} - - "Additional pre-load forces and moments (N,N,N,N-m,N-m,N-m)" -
typedef ^ ^ ReKi AddCLin {:}{:}{:} - - "Additional stiffness matrix" -
typedef ^ ^ ReKi AddBLin {:}{:}{:} - - "Additional linear damping matrix" -
@@ -196,8 +166,8 @@ typedef ^ ^ Integer
typedef ^ ^ R8Ki du {:} - - "vector that determines size of perturbation for u (inputs)" -
typedef ^ ^ R8Ki dx {:} - - "vector that determines size of perturbation for x (continuous states)" -
typedef ^ ^ Integer Jac_ny - - - "number of outputs in jacobian matrix" -
-typedef ^ ParameterType LOGICAL PointsToSeaState - .TRUE. - "Flag that determines if the data contains pointers to SeaState module or if new copies (from restart)" -
typedef ^ ^ logical VisMeshes - .false. - "Output visualization meshes" -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
#
#
# ..... Inputs ....................................................................................................................
diff --git a/modules/hydrodyn/src/HydroDyn_C_Binding.f90 b/modules/hydrodyn/src/HydroDyn_C_Binding.f90
index 287a45116b..00a5e67e30 100644
--- a/modules/hydrodyn/src/HydroDyn_C_Binding.f90
+++ b/modules/hydrodyn/src/HydroDyn_C_Binding.f90
@@ -353,6 +353,12 @@ SUBROUTINE HydroDyn_C_Init( OutRootName_C,
SeaSt%InitInp%defMSL2SWL = REAL(defMSL2SWL_C, ReKi) ! use values from SeaState
SeaSt%InitInp%TMax = REAL(TMax_C, DbKi)
+ ! Platform reference position
+ ! This is only specified as an (X,Y) position (no Z).
+ SeaSt%InitInp%PtfmLocationX = REAL(PtfmRefPtPositionX_C, ReKi)
+ SeaSt%InitInp%PtfmLocationY = REAL(PtfmRefPtPositionY_C, ReKi)
+
+
! Wave elevation output
! Wave elevations can be exported for a set of points (grid or any other layout).
! This feature is used only in the driver codes for exporting for visualization
@@ -398,41 +404,13 @@ SUBROUTINE HydroDyn_C_Init( OutRootName_C,
! Values passed in
HD%InitInp%Gravity = REAL(Gravity_C, ReKi)
- HD%InitInp%WtrDens = REAL(defWtrDens_C, ReKi) ! use values from SeaState
- HD%InitInp%WtrDpth = REAL(defWtrDpth_C, ReKi) ! use values from SeaState
- HD%InitInp% MSL2SWL = REAL(defMSL2SWL_C, ReKi) ! use values from SeaState
HD%InitInp%TMax = REAL(TMax_C, DbKi)
! Transfer data from SeaState
! Need to set up other module's InitInput data here because we will also need to clean up SeaState data and would rather not defer that cleanup
- HD%InitInp%NStepWave = SeaSt%InitOutData%NStepWave
- HD%InitInp%NStepWave2 = SeaSt%InitOutData%NStepWave2
- HD%InitInp%RhoXg = SeaSt%InitOutData%RhoXg
- HD%InitInp%WaveMod = SeaSt%InitOutData%WaveMod
- HD%InitInp%WaveStMod = SeaSt%InitOutData%WaveStMod
- HD%InitInp%WaveDirMod = SeaSt%InitOutData%WaveDirMod
- HD%InitInp%WvLowCOff = SeaSt%InitOutData%WvLowCOff
- HD%InitInp%WvHiCOff = SeaSt%InitOutData%WvHiCOff
- HD%InitInp%WvLowCOffD = SeaSt%InitOutData%WvLowCOffD
- HD%InitInp%WvHiCOffD = SeaSt%InitOutData%WvHiCOffD
- HD%InitInp%WvLowCOffS = SeaSt%InitOutData%WvLowCOffS
- HD%InitInp%WvHiCOffS = SeaSt%InitOutData%WvHiCOffS
HD%InitInp%InvalidWithSSExctn = SeaSt%InitOutData%InvalidWithSSExctn
-
- HD%InitInp%WaveDirMin = SeaSt%InitOutData%WaveDirMin
- HD%InitInp%WaveDirMax = SeaSt%InitOutData%WaveDirMax
- HD%InitInp%WaveDir = SeaSt%InitOutData%WaveDir
- HD%InitInp%WaveMultiDir = SeaSt%InitOutData%WaveMultiDir
- HD%InitInp%WaveDOmega = SeaSt%InitOutData%WaveDOmega
- HD%InitInp%MCFD = SeaSt%InitOutData%MCFD
-
- if(associated(SeaSt%InitOutData%WaveField )) HD%InitInp%WaveField => SeaSt%InitOutData%WaveField
- ! Platform reference position
- ! The HD model uses this for building the moddel. This is only specified as an (X,Y)
- ! position (no Z).
- HD%InitInp%PtfmLocationX = REAL(PtfmRefPtPositionX_C, ReKi)
- HD%InitInp%PtfmLocationY = REAL(PtfmRefPtPositionY_C, ReKi)
+ HD%InitInp%WaveField => SeaSt%InitOutData%WaveField ! can be set regardless of association(); if not associated, HD shouldn't work
!-------------------------------------------------------------
@@ -700,7 +678,7 @@ subroutine CheckDepth(ErrStat3,ErrMsg3)
real(ReKi) :: tmpZpos !< temporary z-position
ErrStat3 = ErrID_None
ErrMsg3 = ""
- tmpZpos=-0.001_ReKi*abs(HD%p%WtrDpth) ! Initial comparison value close to surface
+ tmpZpos=-0.001_ReKi*abs(HD%p%WaveField%EffWtrDpth) ! Initial comparison value close to surface
if ( NumNodePts == 1 .and. HD%u(1)%Morison%Mesh%Committed ) then
do i=1,HD%u(1)%Morison%Mesh%Nnodes
! Find lowest Morison node
@@ -708,7 +686,7 @@ subroutine CheckDepth(ErrStat3,ErrMsg3)
tmpZpos = HD%u(1)%Morison%Mesh%Position(3,i)
endif
enddo
- if (tmpZpos < -abs(HD%p%WtrDpth)*0.9_ReKi) then ! within 10% of the seafloor
+ if (tmpZpos < -abs(HD%p%WaveField%EffWtrDpth)*0.9_ReKi) then ! within 10% of the seafloor
ErrStat3 = ErrID_Severe
ErrMsg3 = "Inconsistent model"//NewLine//" -- Single library input node for simulating rigid floating structure."// &
NewLine//" -- Lowest Morison node is is in lowest 10% of water depth indicating fixed bottom structure from HydroDyn."// &
diff --git a/modules/hydrodyn/src/HydroDyn_DriverCode.f90 b/modules/hydrodyn/src/HydroDyn_DriverCode.f90
index aa09c9bc97..ad0b1d7494 100644
--- a/modules/hydrodyn/src/HydroDyn_DriverCode.f90
+++ b/modules/hydrodyn/src/HydroDyn_DriverCode.f90
@@ -322,30 +322,7 @@ subroutine SetHD_InitInputs()
InitInData_HD%Linearize = drvrData%Linearize
! Data from InitOutData_SeaSt:
- InitInData_HD%WtrDens = InitOutData_SeaSt%WtrDens
- InitInData_HD%WtrDpth = InitOutData_SeaSt%WtrDpth
- InitInData_HD%MSL2SWL = InitOutData_SeaSt%MSL2SWL
- InitInData_HD%NStepWave = InitOutData_SeaSt%NStepWave
- InitInData_HD%NStepWave2 = InitOutData_SeaSt%NStepWave2
- InitInData_HD%RhoXg = InitOutData_SeaSt%RhoXg
- InitInData_HD%WaveMod = InitOutData_SeaSt%WaveMod
- InitInData_HD%WaveStMod = InitOutData_SeaSt%WaveStMod
- InitInData_HD%WaveDirMod = InitOutData_SeaSt%WaveDirMod
- InitInData_HD%WvLowCOff = InitOutData_SeaSt%WvLowCOff
- InitInData_HD%WvHiCOff = InitOutData_SeaSt%WvHiCOff
- InitInData_HD%WvLowCOffD = InitOutData_SeaSt%WvLowCOffD
- InitInData_HD%WvHiCOffD = InitOutData_SeaSt%WvHiCOffD
- InitInData_HD%WvLowCOffS = InitOutData_SeaSt%WvLowCOffS
- InitInData_HD%WvHiCOffS = InitOutData_SeaSt%WvHiCOffS
-
InitInData_HD%InvalidWithSSExctn = InitOutData_SeaSt%InvalidWithSSExctn
-
- InitInData_HD%WaveDirMin = InitOutData_SeaSt%WaveDirMin
- InitInData_HD%WaveDirMax = InitOutData_SeaSt%WaveDirMax
- InitInData_HD%WaveDir = InitOutData_SeaSt%WaveDir
- InitInData_HD%WaveMultiDir = InitOutData_SeaSt%WaveMultiDir
- InitInData_HD%WaveDOmega = InitOutData_SeaSt%WaveDOmega
- InitInData_HD%MCFD = InitOutData_SeaSt%MCFD
InitInData_HD%WaveField => InitOutData_SeaSt%WaveField
diff --git a/modules/hydrodyn/src/HydroDyn_DriverSubs.f90 b/modules/hydrodyn/src/HydroDyn_DriverSubs.f90
index 11bef74431..a9cc5e2c77 100644
--- a/modules/hydrodyn/src/HydroDyn_DriverSubs.f90
+++ b/modules/hydrodyn/src/HydroDyn_DriverSubs.f90
@@ -1010,7 +1010,7 @@ SUBROUTINE PRP_Perturb_u( n, perturb_sign, p, u, EDRPMotion, du, Motion_HDRP, ma
fieldIndx6= mod(n-1,6)+1 ! 1=x, 2=y 3=z 4=theta_x, 5=theta_y 6=theta_z (variable)
! Perturbation amplitude
- perturb_t = 0.02_ReKi*D2R * max(p%WtrDpth,1.0_ReKi) ! translation input scaling
+ perturb_t = 0.02_ReKi*D2R * max(p%WaveField%EffWtrDpth,1.0_ReKi) ! translation input scaling
perturb = 2*D2R ! rotational input scaling
!perturb_t = 1.0
!perturb = 0.1
diff --git a/modules/hydrodyn/src/HydroDyn_Input.f90 b/modules/hydrodyn/src/HydroDyn_Input.f90
index b7b3117521..fd0c1d92c0 100644
--- a/modules/hydrodyn/src/HydroDyn_Input.f90
+++ b/modules/hydrodyn/src/HydroDyn_Input.f90
@@ -228,16 +228,6 @@ SUBROUTINE HydroDyn_ParseInput( InputFileName, OutRootName, FileInfo_In, InputFi
if (Failed()) return;
-!bjj: should we add this?
-!test for numerical stability
-! IF ( FP_InitData%RdtnDT <= FP_InitData%RdtnTMax*EPSILON(FP_InitData%RdtnDT) ) THEN ! Test RdtnDT and RdtnTMax to ensure numerical stability -- HINT: see the use of OnePlusEps."
-! ErrStat = ErrID_Fatal
-! ErrMsg2 = ' RdtnDT must be greater than '//TRIM ( Num2LStr( RdtnTMax*EPSILON(RdtnDT) ) )//' seconds.'
-! if (Failed()) return;
-! END IF
-
-
-
!-------------------------------------------------------------------------------------------------
! Data section for 2nd order WAMIT forces
!-------------------------------------------------------------------------------------------------
@@ -1127,49 +1117,26 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
!-------------------------------------------------------------------------
! Check environmental conditions
!-------------------------------------------------------------------------
-
-
- ! WtrDens - Water density.
-
- IF ( InputFileData%Morison%WtrDens < 0.0 ) THEN
- CALL SetErrStat( ErrID_Fatal,'WtrDens must not be negative.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
-
-
- ! WtrDpth - Water depth
-
- ! First adjust water depth based on MSL2SWL values
- InputFileData%Morison%WtrDpth = InputFileData%Morison%WtrDpth + InputFileData%Morison%MSL2SWL
+ if (.not. associated(InitInp%WaveField)) then
+ call SetErrStat( ErrID_Fatal,' No SeaState information available.',ErrStat,ErrMsg,RoutineName)
+ return
+ endif
- IF ( InputFileData%Morison%WtrDpth <= 0.0 ) THEN
- CALL SetErrStat( ErrID_Fatal,'WtrDpth must be greater than zero.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
-
+ if (InitInp%WaveField%NStepWave == 0) then
+ call SetErrStat( ErrID_Fatal,' No SeaState information available.',ErrStat,ErrMsg,RoutineName)
+ return
+ endif
! MSL2SWL - Mean sea level to still water level
-
-
- IF ( InputFileData%PotMod == 1 .AND. .NOT. EqualRealNos(InputFileData%Morison%MSL2SWL, 0.0_ReKi) ) THEN
+ IF ( InputFileData%PotMod == 1 .AND. .NOT. EqualRealNos(InitInp%WaveField%MSL2SWL, 0.0_ReKi) ) THEN
CALL SetErrStat( ErrID_Fatal,'SeaState MSL2SWL must be 0 when PotMod = 1 (WAMIT).',ErrStat,ErrMsg,RoutineName)
RETURN
END IF
- IF ( InputFileData%PotMod == 1 .AND. .NOT. EqualRealNos(InputFileData%Morison%MSL2SWL, 0.0_ReKi) ) THEN
- CALL SetErrStat( ErrID_Fatal,'HydroDyn MSL2SWL must be 0 when PotMod = 1 (WAMIT).',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
-
- ! WaveMod - Wave kinematics model switch. -- Check that actual data was passed in from SeaState. If none exists, then set WaveMod=0 and warn
- if (.not. associated(InitInp%WaveField) .or. InitInp%NStepWave == 0) then
- call SetErrStat( ErrID_Fatal,' No SeaState wave information available. Setting WaveMod=0.',ErrStat,ErrMsg,RoutineName)
- return
- endif
-
- IF ( InputFileData%PotMod > 0 .and. InitInp%WaveMod == 6 ) THEN
- CALL SetErrStat( ErrID_Fatal,'WaveMod must be 0, 1, 1P#, 2, 3, 4, or 5 when PotMod is not 0',ErrStat,ErrMsg,RoutineName)
+ ! WaveMod - Wave kinematics model switch.
+ IF ( InputFileData%PotMod > 0 .and. InitInp%WaveField%WaveMod == WaveMod_ExtFull ) THEN
+ CALL SetErrStat( ErrID_Fatal,'WaveMod cannot be 6 when PotMod is not 0.',ErrStat,ErrMsg,RoutineName)
RETURN
END IF
@@ -1177,9 +1144,6 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
! LIN-TODO:
!errors if:
!if ( &
- ! (WaveModIn /= 0) .or. &
- ! (InputFileData%Waves2%WvDiffQTFF /= .false.) .or. &
- ! (InputFileData%Waves2%WvSumQTFF /= .false.) .or. &
! (InputFileData%PotMod /= 0 .or. InputFileData%PotMod /=1) .or. &
! (InputFileData%WAMIT%ExctnMod /=0 .or. InputFileData%WAMIT%ExctnMod /=2) .or. &
! (InputFileData%WAMIT%RdtnMod /=0 .or. InputFileData%WAMIT%RdtnMod /=2) .or. &
@@ -1188,45 +1152,6 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
! (InputFileData%WAMIT2%SumQTF /= 0 ) ) then
!
!end if
-
-
- ! WaveStMod - Model switch for stretching incident wave kinematics to instantaneous free surface.
- IF ( InitInp%WaveMod /= 0 .AND. InputFileData%Morison%NMembers > 0 ) THEN
- IF ( InitInp%WaveMod /= 6 ) THEN
- IF ( ( InitInp%WaveStMod /= 0 ) .AND. ( InitInp%WaveStMod /= 1 ) .AND. &
- ( InitInp%WaveStMod /= 2 ) .AND. ( InitInp%WaveStMod /= 3 ) ) THEN
- ErrMsg = ' WaveStMod must be 0, 1, 2, or 3.'
- ErrStat = ErrID_Fatal
- RETURN
- END IF
- ELSE
- IF ( ( InitInp%WaveStMod /= 0 ) .AND. ( InitInp%WaveStMod /= 1 ) .AND. &
- ( InitInp%WaveStMod /= 3 ) ) THEN
- ErrMsg = ' WaveStMod must be 0, 1, or 3 when WaveMod = 6.'
- ErrStat = ErrID_Fatal
- RETURN
- END IF
- END IF
- END IF
-
-
- ! Copy over the first order frequency limits to the WAMIT2 module which needs them.
- InputFileData%WAMIT2%WvLowCOff = InitInp%WvLowCOff
- InputFileData%WAMIT2%WvHiCOff = InitInp%WvHiCOff
-
-
- ! Copy over the 2nd order limits to the WAMIT2 module which needs them.
- InputFileData%WAMIT2%WvLowCOffD = InitInp%WvLowCOffD
- InputFileData%WAMIT2%WvHiCOffD = InitInp%WvHiCOffD
- InputFileData%WAMIT2%WvLowCOffS = InitInp%WvLowCOffS
- InputFileData%WAMIT2%WvHiCOffS = InitInp%WvHiCOffS
-
- ! Set the flag for multidirectional waves for WAMIT2 module. It needs to know since the Newman approximation
- ! can only use uni-directional waves.
- InputFileData%WAMIT2%WaveMultiDir = InitInp%WaveMultiDir
-
-
-
! PotFile - Root name of potential flow files
@@ -1281,7 +1206,7 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
END IF
! ExctnDisp - Method of computing Wave Excitation
- if ( InputFileData%PotMod /= 1 .or. InputFileData%WAMIT%ExctnMod == 0 .or. InitInp%WaveMod == 0) then
+ if ( InputFileData%PotMod /= 1 .or. InputFileData%WAMIT%ExctnMod == 0 .or. InitInp%WaveField%WaveMod == WaveMod_None) then
InputFileData%WAMIT%ExctnDisp = 0 !Force ExctnDisp = 0, so that the Grid of Wave Excitation forces is not computed (saves time and memory)
end if
@@ -1468,29 +1393,6 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
END IF
- ! Check that the min / max diff frequencies make sense if using any DiffQTF method
- IF ( InputFileData%WAMIT2%DiffQTF /= 0 .OR. InputFileData%WAMIT2%MnDrift /= 0 .OR. InputFileData%WAMIT2%NewmanApp /=0 ) THEN
- IF ( ( InputFileData%WAMIT2%WvHiCOffD < InputFileData%WAMIT2%WvLowCOffD ) .OR. ( InputFileData%WAMIT2%WvLowCOffD < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal,'WvHiCOffD must be larger than WvLowCOffD. Both must be positive.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
- ELSE ! set to zero since we don't need them
- InputFileData%WAMIT2%WvLowCOffD = 0.0
- InputFileData%WAMIT2%WvHiCOffD = 0.0
- END IF
-
-
- ! Check that the min / max diff frequencies make sense if using SumQTF
- IF ( InputFileData%WAMIT2%SumQTF /= 0 ) THEN
- IF ( ( InputFileData%WAMIT2%WvHiCOffS < InputFileData%WAMIT2%WvLowCOffS ) .OR. ( InputFileData%WAMIT2%WvLowCOffS < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal,'WvHiCOffS must be larger than WvLowCOffS. Both must be positive.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
- ELSE ! set to zero since we don't need them
- InputFileData%WAMIT2%WvLowCOffS = 0.0
- InputFileData%WAMIT2%WvHiCOffS = 0.0
- END IF
-
! now that it has been established that the input parameters for second order are good, we check to make sure that the WAMIT files actually exist.
! Check MnDrift file
@@ -1553,7 +1455,7 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
if ( (InputFileData%WAMIT%ExctnMod == 2) ) then
if ( InitInp%InvalidWithSSExctn ) then
- call SetErrStat( ErrID_Fatal, 'Given SeaState conditions cannot be used with state-space wave excitations. In SeaState, set WaveMod to 0, 1, 1P#, 2, 3, 4, or 5; WaveDirMod=0; WvDiffQTF=FALSE; and WvSumQTF=FALSE. Or in HydroDyn set ExctnMod to 0 or 1.', ErrStat, ErrMsg, RoutineName )
+ call SetErrStat( ErrID_Fatal, 'Given SeaState conditions cannot be used with state-space wave excitations. In SeaState, WaveMod cannot be 6; WaveDirMod must be 0; WvDiffQTF must be FALSE; and WvSumQTF must be FALSE. Or in HydroDyn set ExctnMod to 0 or 1.', ErrStat, ErrMsg, RoutineName )
end if
@@ -2227,7 +2129,7 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
CALL SetErrStat(ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) RETURN
ELSE
- InputFileData%Morison%FilledGroups(I)%FillDens = InputFileData%Morison%WtrDens
+ InputFileData%Morison%FilledGroups(I)%FillDens = InitInp%WaveField%WtrDens
END IF
END DO
@@ -2425,19 +2327,15 @@ SUBROUTINE HydroDynInput_ProcessInitData( InitInp, Interval, InputFileData, ErrS
!----------------------------------------------------------
! WAMIT
- InputFileData%WAMIT%WtrDens = InputFileData%Morison%WtrDens
- InputFileData%WAMIT%WaveMod = InitInp%WaveMod
InputFileData%WAMIT%HasWAMIT = InputFileData%PotMod == 1
! WAMIT2
- InputFileData%WAMIT2%WtrDens = InputFileData%Morison%WtrDens
- InputFileData%WAMIT2%WaveMod = InitInp%WaveMod
InputFileData%WAMIT2%HasWAMIT = InputFileData%PotMod == 1
! Morison
InputFileData%Morison%UnSum = InputFileData%UnSum
InputFileData%Morison%Gravity = InitInp%Gravity
! Process the input geometry and generate the simulation mesh representation
- call Morison_GenerateSimulationNodes( InputFileData%Morison%MSL2SWL, InputFileData%Morison%NJoints, InputFileData%Morison%InpJoints, InputFileData%Morison%NMembers, InputFileData%Morison%InpMembers, InputFileData%Morison%NNodes, InputFileData%Morison%Nodes, errStat2, errMsg2 )
+ call Morison_GenerateSimulationNodes( InitInp%WaveField%MSL2SWL, InputFileData%Morison%NJoints, InputFileData%Morison%InpJoints, InputFileData%Morison%NMembers, InputFileData%Morison%InpMembers, InputFileData%Morison%NNodes, InputFileData%Morison%Nodes, errStat2, errMsg2 )
!CALL Morison_ProcessMorisonGeometry( InputFileData%Morison, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'HydroDynInput_GetInput' )
IF ( ErrStat >= AbortErrLev ) RETURN
diff --git a/modules/hydrodyn/src/HydroDyn_Output.f90 b/modules/hydrodyn/src/HydroDyn_Output.f90
index 95f1693bc7..1823f1e565 100644
--- a/modules/hydrodyn/src/HydroDyn_Output.f90
+++ b/modules/hydrodyn/src/HydroDyn_Output.f90
@@ -1006,9 +1006,10 @@ SUBROUTINE HDOUT_Init( HydroDyn_ProgDesc, OutRootName, InputFileData, y, p, m,
! Check that the variables in OutList are valid
!-------------------------------------------------------------------------------------------------
-
- CALL SetOutParam(InputFileData%OutList, p, ErrStat, ErrMsg )
- IF ( ErrStat >= AbortErrLev ) RETURN
+ if (allocated(InputFileData%OutList)) then
+ CALL SetOutParam(InputFileData%OutList, p, ErrStat, ErrMsg )
+ IF ( ErrStat >= AbortErrLev ) RETURN
+ end if
! Aggregate the sub-module initialization outputs for the glue code
diff --git a/modules/hydrodyn/src/HydroDyn_Types.f90 b/modules/hydrodyn/src/HydroDyn_Types.f90
index 8f650ed9a4..6e5e13a26c 100644
--- a/modules/hydrodyn/src/HydroDyn_Types.f90
+++ b/modules/hydrodyn/src/HydroDyn_Types.f90
@@ -49,7 +49,6 @@ MODULE HydroDyn_Types
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AddCLin !< Additional stiffness matrix [-]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AddBLin !< Additional linear damping matrix [-]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AddBQuad !< Additional quadratic damping (drag) matrix [-]
- TYPE(SeaSt_InitInputType) :: SeaState !< Initialization data for SeaState module [-]
CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: PotFile !< The name of the root potential flow file (without extension for WAMIT, complete name for FIT) [-]
INTEGER(IntKi) :: nWAMITObj = 0_IntKi !< number of WAMIT input files. If NBodyMod = 1 then nPotFiles will be 1 even if NBody > 1 [-]
INTEGER(IntKi) :: vecMultiplier = 0_IntKi !< multiplier for the WAMIT vectors and matrices. If NBodyMod=1 then this = NBody, else 1 [-]
@@ -89,34 +88,9 @@ MODULE HydroDyn_Types
CHARACTER(1024) :: OutRootName !< Supplied by Driver: The name of the root file (without extension) including the full path [-]
LOGICAL :: Linearize = .FALSE. !< Flag that tells this module if the glue code wants to linearize. [-]
REAL(ReKi) :: Gravity = 0.0_ReKi !< Supplied by Driver: Gravitational acceleration [(m/s^2)]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density from the driver; may be overwritten [(kg/m^3)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth from the driver; may be overwritten [m]
- REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Mean sea level to still water level from the driver; may be overwritten [m]
REAL(DbKi) :: TMax = 0.0_R8Ki !< Supplied by Driver: The total simulation time [(sec)]
- REAL(ReKi) :: PtfmLocationX = 0.0_ReKi !< Supplied by Driver: X coordinate of platform location in the wave field [m]
- REAL(ReKi) :: PtfmLocationY = 0.0_ReKi !< Supplied by Driver: Y coordinate of platform location in the wave field [m]
LOGICAL :: VisMeshes = .false. !< Output visualization meshes [-]
- INTEGER(IntKi) :: NStepWave = 0 !< Total number of frequency components = total number of time steps in the incident wave [-]
- INTEGER(IntKi) :: NStepWave2 = 0 !< NStepWave / 2 [-]
- REAL(SiKi) :: RhoXg = 0.0_R4Ki !< = WtrDens*Gravity [-]
- INTEGER(IntKi) :: WaveMod = 0_IntKi !< Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED } [-]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} [-]
- INTEGER(IntKi) :: WaveDirMod = 0_IntKi !< Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6] [-]
- REAL(SiKi) :: WvLowCOff = 0.0_R4Ki !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WvHiCOff = 0.0_R4Ki !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WvLowCOffD = 0.0_R4Ki !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffD = 0.0_R4Ki !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvLowCOffS = 0.0_R4Ki !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffS = 0.0_R4Ki !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
LOGICAL :: InvalidWithSSExctn = .false. !< Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2) [(-)]
- REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElev0 !< Instantaneous elevation time-series of incident waves at the platform reference point [(meters)]
- REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE :: WaveElevC !< Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part [(meters)]
- REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction. [(degrees)]
- REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction. [(degrees)]
- REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Incident wave propagation heading direction [(degrees)]
- LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
- REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
- REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of MacCamy-Fuchs members [(meters)]
TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to SeaState wave field [-]
END TYPE HydroDyn_InitInputType
! =======================
@@ -170,7 +144,6 @@ MODULE HydroDyn_Types
TYPE(HD_ModuleMapType) :: HD_MeshMap
INTEGER(IntKi) :: Decimate = 0_IntKi !< The output decimation counter [-]
REAL(DbKi) :: LastOutTime = 0.0_R8Ki !< Last time step which was written to the output file (sec) [-]
- INTEGER(IntKi) :: LastIndWave = 0_IntKi !< The last index used in the wave kinematics arrays, used to optimize interpolation [-]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: F_PtfmAdd !< The total forces and moments due to additional pre-load, stiffness, and damping [-]
REAL(ReKi) , DIMENSION(1:6) :: F_Hydro = 0.0_ReKi !< The total hydrodynamic forces and moments integrated about the (0,0,0) platform reference point [-]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: F_Waves !< The total waves forces on a WAMIT body calculated by first and second order methods (WAMIT and WAMIT2 modules) [-]
@@ -194,9 +167,6 @@ MODULE HydroDyn_Types
INTEGER(IntKi) :: totalStates = 0_IntKi !< Number of excitation and radiation states for all WAMIT bodies [-]
INTEGER(IntKi) :: totalExctnStates = 0_IntKi !< Number of excitation states for all WAMIT bodies [-]
INTEGER(IntKi) :: totalRdtnStates = 0_IntKi !< Number of radiation states for all WAMIT bodies [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Array of time samples, (sec) [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Number of data points in the wave kinematics arrays [-]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [(m)]
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: AddF0 !< Additional pre-load forces and moments (N,N,N,N-m,N-m,N-m) [-]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AddCLin !< Additional stiffness matrix [-]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AddBLin !< Additional linear damping matrix [-]
@@ -215,8 +185,8 @@ MODULE HydroDyn_Types
REAL(R8Ki) , DIMENSION(:), ALLOCATABLE :: du !< vector that determines size of perturbation for u (inputs) [-]
REAL(R8Ki) , DIMENSION(:), ALLOCATABLE :: dx !< vector that determines size of perturbation for x (continuous states) [-]
INTEGER(IntKi) :: Jac_ny = 0_IntKi !< number of outputs in jacobian matrix [-]
- LOGICAL :: PointsToSeaState = .TRUE. !< Flag that determines if the data contains pointers to SeaState module or if new copies (from restart) [-]
LOGICAL :: VisMeshes = .false. !< Output visualization meshes [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to SeaState wave field [-]
END TYPE HydroDyn_ParameterType
! =======================
! ========= HydroDyn_InputType =======
@@ -298,9 +268,6 @@ subroutine HydroDyn_CopyInputFile(SrcInputFileData, DstInputFileData, CtrlCode,
end if
DstInputFileData%AddBQuad = SrcInputFileData%AddBQuad
end if
- call SeaSt_CopyInitInput(SrcInputFileData%SeaState, DstInputFileData%SeaState, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
if (allocated(SrcInputFileData%PotFile)) then
LB(1:1) = lbound(SrcInputFileData%PotFile)
UB(1:1) = ubound(SrcInputFileData%PotFile)
@@ -480,8 +447,6 @@ subroutine HydroDyn_DestroyInputFile(InputFileData, ErrStat, ErrMsg)
if (allocated(InputFileData%AddBQuad)) then
deallocate(InputFileData%AddBQuad)
end if
- call SeaSt_DestroyInitInput(InputFileData%SeaState, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (allocated(InputFileData%PotFile)) then
deallocate(InputFileData%PotFile)
end if
@@ -549,7 +514,6 @@ subroutine HydroDyn_PackInputFile(Buf, Indata)
call RegPackBounds(Buf, 3, lbound(InData%AddBQuad), ubound(InData%AddBQuad))
call RegPack(Buf, InData%AddBQuad)
end if
- call SeaSt_PackInitInput(Buf, InData%SeaState)
call RegPack(Buf, allocated(InData%PotFile))
if (allocated(InData%PotFile)) then
call RegPackBounds(Buf, 1, lbound(InData%PotFile), ubound(InData%PotFile))
@@ -692,7 +656,6 @@ subroutine HydroDyn_UnPackInputFile(Buf, OutData)
call RegUnpack(Buf, OutData%AddBQuad)
if (RegCheckErr(Buf, RoutineName)) return
end if
- call SeaSt_UnpackInitInput(Buf, OutData%SeaState) ! SeaState
if (allocated(OutData%PotFile)) deallocate(OutData%PotFile)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -888,7 +851,7 @@ subroutine HydroDyn_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode,
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(0), UB(0)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'HydroDyn_CopyInitInput'
@@ -902,56 +865,9 @@ subroutine HydroDyn_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode,
DstInitInputData%OutRootName = SrcInitInputData%OutRootName
DstInitInputData%Linearize = SrcInitInputData%Linearize
DstInitInputData%Gravity = SrcInitInputData%Gravity
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
- DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL
DstInitInputData%TMax = SrcInitInputData%TMax
- DstInitInputData%PtfmLocationX = SrcInitInputData%PtfmLocationX
- DstInitInputData%PtfmLocationY = SrcInitInputData%PtfmLocationY
DstInitInputData%VisMeshes = SrcInitInputData%VisMeshes
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
- DstInitInputData%NStepWave2 = SrcInitInputData%NStepWave2
- DstInitInputData%RhoXg = SrcInitInputData%RhoXg
- DstInitInputData%WaveMod = SrcInitInputData%WaveMod
- DstInitInputData%WaveStMod = SrcInitInputData%WaveStMod
- DstInitInputData%WaveDirMod = SrcInitInputData%WaveDirMod
- DstInitInputData%WvLowCOff = SrcInitInputData%WvLowCOff
- DstInitInputData%WvHiCOff = SrcInitInputData%WvHiCOff
- DstInitInputData%WvLowCOffD = SrcInitInputData%WvLowCOffD
- DstInitInputData%WvHiCOffD = SrcInitInputData%WvHiCOffD
- DstInitInputData%WvLowCOffS = SrcInitInputData%WvLowCOffS
- DstInitInputData%WvHiCOffS = SrcInitInputData%WvHiCOffS
DstInitInputData%InvalidWithSSExctn = SrcInitInputData%InvalidWithSSExctn
- if (allocated(SrcInitInputData%WaveElev0)) then
- LB(1:1) = lbound(SrcInitInputData%WaveElev0)
- UB(1:1) = ubound(SrcInitInputData%WaveElev0)
- if (.not. allocated(DstInitInputData%WaveElev0)) then
- allocate(DstInitInputData%WaveElev0(LB(1):UB(1)), stat=ErrStat2)
- if (ErrStat2 /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%WaveElev0.', ErrStat, ErrMsg, RoutineName)
- return
- end if
- end if
- DstInitInputData%WaveElev0 = SrcInitInputData%WaveElev0
- end if
- if (allocated(SrcInitInputData%WaveElevC)) then
- LB(1:3) = lbound(SrcInitInputData%WaveElevC)
- UB(1:3) = ubound(SrcInitInputData%WaveElevC)
- if (.not. allocated(DstInitInputData%WaveElevC)) then
- allocate(DstInitInputData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)), stat=ErrStat2)
- if (ErrStat2 /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%WaveElevC.', ErrStat, ErrMsg, RoutineName)
- return
- end if
- end if
- DstInitInputData%WaveElevC = SrcInitInputData%WaveElevC
- end if
- DstInitInputData%WaveDirMin = SrcInitInputData%WaveDirMin
- DstInitInputData%WaveDirMax = SrcInitInputData%WaveDirMax
- DstInitInputData%WaveDir = SrcInitInputData%WaveDir
- DstInitInputData%WaveMultiDir = SrcInitInputData%WaveMultiDir
- DstInitInputData%WaveDOmega = SrcInitInputData%WaveDOmega
- DstInitInputData%MCFD = SrcInitInputData%MCFD
DstInitInputData%WaveField => SrcInitInputData%WaveField
end subroutine
@@ -966,12 +882,6 @@ subroutine HydroDyn_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
ErrMsg = ''
call NWTC_Library_DestroyFileInfoType(InitInputData%PassedFileData, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (allocated(InitInputData%WaveElev0)) then
- deallocate(InitInputData%WaveElev0)
- end if
- if (allocated(InitInputData%WaveElevC)) then
- deallocate(InitInputData%WaveElevC)
- end if
nullify(InitInputData%WaveField)
end subroutine
@@ -987,42 +897,9 @@ subroutine HydroDyn_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%OutRootName)
call RegPack(Buf, InData%Linearize)
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%MSL2SWL)
call RegPack(Buf, InData%TMax)
- call RegPack(Buf, InData%PtfmLocationX)
- call RegPack(Buf, InData%PtfmLocationY)
call RegPack(Buf, InData%VisMeshes)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
- call RegPack(Buf, InData%RhoXg)
- call RegPack(Buf, InData%WaveMod)
- call RegPack(Buf, InData%WaveStMod)
- call RegPack(Buf, InData%WaveDirMod)
- call RegPack(Buf, InData%WvLowCOff)
- call RegPack(Buf, InData%WvHiCOff)
- call RegPack(Buf, InData%WvLowCOffD)
- call RegPack(Buf, InData%WvHiCOffD)
- call RegPack(Buf, InData%WvLowCOffS)
- call RegPack(Buf, InData%WvHiCOffS)
call RegPack(Buf, InData%InvalidWithSSExctn)
- call RegPack(Buf, allocated(InData%WaveElev0))
- if (allocated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPack(Buf, InData%WaveElev0)
- end if
- call RegPack(Buf, allocated(InData%WaveElevC))
- if (allocated(InData%WaveElevC)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElevC), ubound(InData%WaveElevC))
- call RegPack(Buf, InData%WaveElevC)
- end if
- call RegPack(Buf, InData%WaveDirMin)
- call RegPack(Buf, InData%WaveDirMax)
- call RegPack(Buf, InData%WaveDir)
- call RegPack(Buf, InData%WaveMultiDir)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, InData%MCFD)
call RegPack(Buf, associated(InData%WaveField))
if (associated(InData%WaveField)) then
call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
@@ -1037,7 +914,7 @@ subroutine HydroDyn_UnPackInitInput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(HydroDyn_InitInputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'HydroDyn_UnPackInitInput'
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(0), UB(0)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -1054,86 +931,12 @@ subroutine HydroDyn_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MSL2SWL)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%TMax)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%PtfmLocationX)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%PtfmLocationY)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%VisMeshes)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%RhoXg)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%InvalidWithSSExctn)
if (RegCheckErr(Buf, RoutineName)) return
- if (allocated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- if (allocated(OutData%WaveElevC)) deallocate(OutData%WaveElevC)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- allocate(OutData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- call RegUnpack(Buf, OutData%WaveElevC)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- call RegUnpack(Buf, OutData%WaveDirMin)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMax)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMultiDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MCFD)
- if (RegCheckErr(Buf, RoutineName)) return
if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -1900,7 +1703,6 @@ subroutine HydroDyn_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg
if (ErrStat >= AbortErrLev) return
DstMiscData%Decimate = SrcMiscData%Decimate
DstMiscData%LastOutTime = SrcMiscData%LastOutTime
- DstMiscData%LastIndWave = SrcMiscData%LastIndWave
if (allocated(SrcMiscData%F_PtfmAdd)) then
LB(1:1) = lbound(SrcMiscData%F_PtfmAdd)
UB(1:1) = ubound(SrcMiscData%F_PtfmAdd)
@@ -2042,7 +1844,6 @@ subroutine HydroDyn_PackMisc(Buf, Indata)
call HydroDyn_PackHD_ModuleMapType(Buf, InData%HD_MeshMap)
call RegPack(Buf, InData%Decimate)
call RegPack(Buf, InData%LastOutTime)
- call RegPack(Buf, InData%LastIndWave)
call RegPack(Buf, allocated(InData%F_PtfmAdd))
if (allocated(InData%F_PtfmAdd)) then
call RegPackBounds(Buf, 1, lbound(InData%F_PtfmAdd), ubound(InData%F_PtfmAdd))
@@ -2100,8 +1901,6 @@ subroutine HydroDyn_UnPackMisc(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%LastOutTime)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%LastIndWave)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%F_PtfmAdd)) deallocate(OutData%F_PtfmAdd)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -2237,9 +2036,6 @@ subroutine HydroDyn_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, Err
DstParamData%totalStates = SrcParamData%totalStates
DstParamData%totalExctnStates = SrcParamData%totalExctnStates
DstParamData%totalRdtnStates = SrcParamData%totalRdtnStates
- DstParamData%WaveTime => SrcParamData%WaveTime
- DstParamData%NStepWave = SrcParamData%NStepWave
- DstParamData%WtrDpth = SrcParamData%WtrDpth
if (allocated(SrcParamData%AddF0)) then
LB(1:2) = lbound(SrcParamData%AddF0)
UB(1:2) = ubound(SrcParamData%AddF0)
@@ -2350,8 +2146,8 @@ subroutine HydroDyn_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, Err
DstParamData%dx = SrcParamData%dx
end if
DstParamData%Jac_ny = SrcParamData%Jac_ny
- DstParamData%PointsToSeaState = SrcParamData%PointsToSeaState
DstParamData%VisMeshes = SrcParamData%VisMeshes
+ DstParamData%WaveField => SrcParamData%WaveField
end subroutine
subroutine HydroDyn_DestroyParam(ParamData, ErrStat, ErrMsg)
@@ -2385,7 +2181,6 @@ subroutine HydroDyn_DestroyParam(ParamData, ErrStat, ErrMsg)
end if
call Morison_DestroyParam(ParamData%Morison, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- nullify(ParamData%WaveTime)
if (allocated(ParamData%AddF0)) then
deallocate(ParamData%AddF0)
end if
@@ -2416,6 +2211,7 @@ subroutine HydroDyn_DestroyParam(ParamData, ErrStat, ErrMsg)
if (allocated(ParamData%dx)) then
deallocate(ParamData%dx)
end if
+ nullify(ParamData%WaveField)
end subroutine
subroutine HydroDyn_PackParam(Buf, Indata)
@@ -2454,16 +2250,6 @@ subroutine HydroDyn_PackParam(Buf, Indata)
call RegPack(Buf, InData%totalStates)
call RegPack(Buf, InData%totalExctnStates)
call RegPack(Buf, InData%totalRdtnStates)
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%WtrDpth)
call RegPack(Buf, allocated(InData%AddF0))
if (allocated(InData%AddF0)) then
call RegPackBounds(Buf, 2, lbound(InData%AddF0), ubound(InData%AddF0))
@@ -2518,8 +2304,14 @@ subroutine HydroDyn_PackParam(Buf, Indata)
call RegPack(Buf, InData%dx)
end if
call RegPack(Buf, InData%Jac_ny)
- call RegPack(Buf, InData%PointsToSeaState)
call RegPack(Buf, InData%VisMeshes)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
+ if (.not. PtrInIndex) then
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
+ end if
+ end if
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -2583,34 +2375,6 @@ subroutine HydroDyn_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%totalRdtnStates)
if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%AddF0)) deallocate(OutData%AddF0)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -2744,10 +2508,28 @@ subroutine HydroDyn_UnPackParam(Buf, OutData)
end if
call RegUnpack(Buf, OutData%Jac_ny)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%PointsToSeaState)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%VisMeshes)
if (RegCheckErr(Buf, RoutineName)) return
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
+ call RegUnpack(Buf, IsAllocAssoc)
+ if (RegCheckErr(Buf, RoutineName)) return
+ if (IsAllocAssoc) then
+ call RegUnpackPointer(Buf, Ptr, PtrIdx)
+ if (RegCheckErr(Buf, RoutineName)) return
+ if (c_associated(Ptr)) then
+ call c_f_pointer(Ptr, OutData%WaveField)
+ else
+ allocate(OutData%WaveField,stat=stat)
+ if (stat /= 0) then
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ return
+ end if
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
+ end if
+ else
+ OutData%WaveField => null()
+ end if
end subroutine
subroutine HydroDyn_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg)
diff --git a/modules/hydrodyn/src/Morison.f90 b/modules/hydrodyn/src/Morison.f90
index cdd6f63966..38e1d23a4f 100644
--- a/modules/hydrodyn/src/Morison.f90
+++ b/modules/hydrodyn/src/Morison.f90
@@ -503,11 +503,10 @@ SUBROUTINE FloodedBallastPartSegment(R1, R2, L, rho, V, m, h_c, Il, Ir)
END SUBROUTINE FloodedBallastPartSegment
!----------------------------------------------------------------------------------------------------------------------------------
-SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMembers, members, &
+SUBROUTINE WriteSummaryFile( UnSum, numJoints, numNodes, nodes, numMembers, members, &
NOutputs, OutParam, MOutLst, JOutLst, uMesh, yMesh, p, m, errStat, errMsg )
INTEGER, INTENT ( IN ) :: UnSum
- REAL(ReKi), INTENT ( IN ) :: MSL2SWL
INTEGER, INTENT ( IN ) :: numJoints
INTEGER, INTENT ( IN ) :: numNodes
TYPE(Morison_NodeType), ALLOCATABLE, INTENT ( IN ) :: nodes(:)
@@ -681,7 +680,7 @@ SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMemb
DO J = 1, yMesh%Nnodes
- if ( yMesh%Position(3,J) <= MSL2SWL ) then ! need to check relative to MSL2SWL offset because the Mesh Positons are relative to MSL
+ if ( yMesh%Position(3,J) <= p%WaveField%MSL2SWL ) then ! need to check relative to MSL2SWL offset because the Mesh Positons are relative to MSL
if (J <= numJoints) then
ptLoad = F_B(:,J) + m%F_B_end(:,J)
@@ -789,7 +788,7 @@ SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMemb
do I = 1,numJoints
! need to add MSL2SWL offset from this because the Positons are relative to SWL, but we should report them relative to MSL here
pos = nodes(i)%Position
- pos(3) = pos(3) + MSL2SWL
+ pos(3) = pos(3) + p%WaveField%MSL2SWL
write( UnSum, '(1X,I5,(2X,A10),3(2X,F10.4),2(2X,A10),2(2X,ES10.3),10(2X,A10),3(2X,ES10.3))' ) i,' - ', pos, ' - ', ' - ', nodes(i)%tMG, nodes(i)%MGdensity, ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', nodes(i)%JAxCd, nodes(i)%JAxCa, nodes(i)%JAxCp
end do
c = numJoints
@@ -803,7 +802,7 @@ SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMemb
end if
! need to add MSL2SWL offset from this because the Positons are relative to SWL, but we should report them relative to MSL here
pos = nodes(c)%Position
- pos(3) = pos(3) + MSL2SWL
+ pos(3) = pos(3) + p%WaveField%MSL2SWL
if (members(j)%flipped) then
II=members(j)%NElements+2-I
else
@@ -903,9 +902,9 @@ SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMemb
node2 = nodes(mem%NodeIndx(mem%NElements+1))
! need to add MSL2SWL offset from this because the Positons are relative to SWL, but we should report them relative to MSL here
pos = node1%Position
- pos(3) = pos(3) + MSL2SWL
+ pos(3) = pos(3) + p%WaveField%MSL2SWL
pos2 = node2%Position
- pos2(3) = pos2(3) + MSL2SWL
+ pos2(3) = pos2(3) + p%WaveField%MSL2SWL
outLoc = pos*(1-s) + pos2*s
WRITE( UnSum, '(1X,A10,3(2x,F10.4),2x,I10,7(2x,F10.4))' ) OutParam(I)%Name, outLoc, MOutLst(mbrIndx)%MemberID, pos,pos2, s
END IF
@@ -931,7 +930,7 @@ SUBROUTINE WriteSummaryFile( UnSum, MSL2SWL, numJoints, numNodes, nodes, numMemb
m1 = JOutLst(nodeIndx)%JointIDIndx
! need to add MSL2SWL offset from this because the Positons are relative to SWL, but we should report them relative to MSL here
pos = nodes(m1)%Position
- pos(3) = pos(3) + MSL2SWL
+ pos(3) = pos(3) + p%WaveField%MSL2SWL
WRITE( UnSum, '(1X,A10,3(2x,F10.4),2x,I10)' ) OutParam(I)%Name, pos, JOutLst(nodeIndx)%JointID
END IF
@@ -1427,8 +1426,7 @@ subroutine FlipMemberNodeData( member, nodes, doSwap)
end subroutine FlipMemberNodeData
!----------------------------------------------------------------------------------------------------------------------------------
-subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIndx, MmbrFilledIDIndx, propSet1, propSet2, InitInp, errStat, errMsg )
- real(ReKi), intent (in ) :: MSL2SWL
+subroutine SetMemberProperties( gravity, member, MCoefMod, MmbrCoefIDIndx, MmbrFilledIDIndx, propSet1, propSet2, InitInp, errStat, errMsg )
real(ReKi), intent (in ) :: gravity
type(Morison_MemberType), intent (inout) :: member
integer(IntKi), intent (in ) :: MCoefMod
@@ -1441,7 +1439,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
character(*), intent ( out) :: errMsg ! Error message if errStat /= ErrID_None
integer(IntKi) :: N, i
- real(ReKi) :: WtrDepth,s, dl
+ real(ReKi) :: s, dl
real(ReKi) :: vec(3)
real(ReKi) :: memLength
real(ReKi) :: Za
@@ -1461,7 +1459,6 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
errStat = ErrID_None
errMSg = ''
- WtrDepth = InitInp%WtrDpth
N = member%NElements
dl = member%dl
@@ -1484,7 +1481,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
! These are all per node and not done here, yet
do i = 1, member%NElements+1
- call SetNodeMG( InitInp%NMGDepths, InitInp%MGDepths, InitInp%Nodes(member%NodeIndx(i)), InitInp%MSL2SWL, member%tMG(i), member%MGDensity(i) )
+ call SetNodeMG( InitInp%NMGDepths, InitInp%MGDepths, InitInp%Nodes(member%NodeIndx(i)), InitInp%WaveField%MSL2SWL, member%tMG(i), member%MGDensity(i) )
end do
member%R( 1) = propSet1%PropD / 2.0
@@ -1500,7 +1497,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
member%RMG(i) = member%R(i) + member%tMG(i)
end do
- call SetExternalHydroCoefs( MSL2SWL, MCoefMod, MmbrCoefIDIndx, InitInp%SimplCd, InitInp%SimplCdMG, InitInp%SimplCa, InitInp%SimplCaMG, InitInp%SimplCp, &
+ call SetExternalHydroCoefs( InitInp%WaveField%MSL2SWL, MCoefMod, MmbrCoefIDIndx, InitInp%SimplCd, InitInp%SimplCdMG, InitInp%SimplCa, InitInp%SimplCaMG, InitInp%SimplCp, &
InitInp%SimplCpMG, InitInp%SimplAxCd, InitInp%SimplAxCdMG, InitInp%SimplAxCa, InitInp%SimplAxCaMG, InitInp%SimplAxCp, InitInp%SimplAxCpMG, &
InitInp%SimplCb, InitInp%SimplCbMG, InitInp%SimplMCF, &
InitInp%CoefMembers, InitInp%NCoefDpth, InitInp%CoefDpths, InitInp%Nodes, member )
@@ -1528,14 +1525,14 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
END IF
! Check radius
DO i = 1, member%NElements+1
- IF ( (member%RMG(i) .GT. 1.1_ReKi*REAL(0.5_SiKi*InitInp%MCFD)) .OR. (member%RMG(i) .LT. 0.9_ReKi*REAL(0.5_SiKi*InitInp%MCFD)) ) THEN
+ IF ( (member%RMG(i) .GT. 1.1_ReKi*REAL(0.5_SiKi*InitInp%WaveField%MCFD)) .OR. (member%RMG(i) .LT. 0.9_ReKi*REAL(0.5_SiKi*InitInp%WaveField%MCFD)) ) THEN
! Error because MacCamy-Fuchs members must have a diameter within +/-10% of MCFD specified in seastate.
CALL SetErrStat(ErrID_Fatal, 'MacCamy-Fuchs members must have a diameter within +/-10% of MCFD specified in the SeaState input file. This is not true for Member ID '//trim(num2lstr(member%MemberID)), errStat, errMsg, 'SetMemberProperties' )
RETURN
END IF
END DO
! Check draft-to-radius ratio
- IF ( (-InitInp%Nodes(member%NodeIndx(1))%Position(3)) < 0.5_SiKi*InitInp%MCFD ) THEN
+ IF ( (-InitInp%Nodes(member%NodeIndx(1))%Position(3)) < 0.5_SiKi*InitInp%WaveField%MCFD ) THEN
CALL SetErrStat(ErrID_Fatal, 'Initial draft of MacCamy-Fuchs members should be at least as large as their radius. This is not true for Member ID '//trim(num2lstr(member%MemberID)), errStat, errMsg, 'SetMemberProperties' )
RETURN
END IF
@@ -1545,7 +1542,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
member%MmbrFilledIDIndx = MmbrFilledIDIndx ! Set this to the parameter version of this member data
if ( MmbrFilledIDIndx > 0 ) then
member%FillDens = InitInp%FilledGroups(MmbrFilledIDIndx)%FillDens
- member%FillFSLoc = InitInp%FilledGroups(MmbrFilledIDIndx)%FillFSLoc - InitInp%MSL2SWL
+ member%FillFSLoc = InitInp%FilledGroups(MmbrFilledIDIndx)%FillFSLoc - InitInp%WaveField%MSL2SWL
if (member%FillFSLoc >= Zb) then
member%z_overfill = member%FillFSLoc - Zb
member%l_fill = member%RefLength
@@ -1557,7 +1554,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
member%l_fill = 0.0_ReKi
else
member%z_overfill =0
- if ( Zb <= -InitInp%WtrDpth ) then
+ if ( Zb <= -InitInp%WaveField%EffWtrDpth ) then
member%memfloodstatus = 0 ! member fully buried in seabed
member%l_fill = 0
else
@@ -1585,7 +1582,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
call SetErrStat(ErrID_Fatal, 'The lower end-plate of a member must not cross the water plane. This is not true for Member ID '//trim(num2lstr(member%MemberID)), errStat, errMsg, 'SetMemberProperties' )
end if
end if
- if ( ( Za < -WtrDepth .and. Zb >= -WtrDepth ) .and. ( phi > 10.0*d2r .or. abs((member%RMG(N+1) - member%RMG(1))/member%RefLength)>0.1 ) ) then
+ if ( ( Za < -InitInp%WaveField%EffWtrDpth .and. Zb >= -InitInp%WaveField%EffWtrDpth ) .and. ( phi > 10.0*d2r .or. abs((member%RMG(N+1) - member%RMG(1))/member%RefLength)>0.1 ) ) then
call SetErrStat(ErrID_Fatal, 'A member which crosses the seabed must not be inclined more than 10 degrees from vertical or have a taper larger than 0.1. This is not true for Member ID '//trim(num2lstr(member%MemberID)), errStat, errMsg, 'SetMemberProperties' )
end if
@@ -1596,20 +1593,20 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
member%h_floor = 0.0_ReKi
member%i_floor = member%NElements+1 ! Default to entire member is below the seabed
member%doEndBuoyancy = .false.
- if (Za < -WtrDepth) then
+ if (Za < -InitInp%WaveField%EffWtrDpth) then
do i= 2, member%NElements+1
Za = InitInp%Nodes(member%NodeIndx(i))%Position(3)
- if (Za > -WtrDepth) then ! find the lowest node above the seabed
+ if (Za > -InitInp%WaveField%EffWtrDpth) then ! find the lowest node above the seabed
if (cosPhi < 0.173648178 ) then ! phi > 80 degrees and member is seabed crossing
call SetErrStat(ErrID_Fatal, 'A seabed crossing member must have an inclination angle of <= 80 degrees from vertical. This is not true for Member ID '//trim(num2lstr(member%MemberID)), errStat, errMsg, 'SetMemberProperties' )
end if
- member%h_floor = (-WtrDepth-Za)/cosPhi ! get the distance from the node to the seabed along the member axis (negative value)
+ member%h_floor = (-InitInp%WaveField%EffWtrDpth-Za)/cosPhi ! get the distance from the node to the seabed along the member axis (negative value)
member%i_floor = i-1 ! record the number of the element that pierces the seabed
member%doEndBuoyancy = .true.
exit
- else if ( EqualRealNos(Za, -WtrDepth ) ) then
+ else if ( EqualRealNos(Za, -InitInp%WaveField%EffWtrDpth ) ) then
member%doEndBuoyancy = .true.
end if
end do
@@ -1714,7 +1711,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
! Determine volumes to add to Non-WAMIT modeled members, etc.
if (.not. member%PropPot) then
- if (Zb < -WtrDepth) then
+ if (Zb < -InitInp%WaveField%EffWtrDpth) then
! fully buried element, do not add these volume contributions to totals
else if (0.0 >= Zb) then ! Bug fix per OpenFAST issue #844 GJH 2/3/2022
! fully submerged elements.
@@ -1747,7 +1744,7 @@ subroutine SetMemberProperties( MSL2SWL, gravity, member, MCoefMod, MmbrCoefIDIn
li = dl*(i-1)
! fully buried element
- if (Zb < -WtrDepth) then
+ if (Zb < -InitInp%WaveField%EffWtrDpth) then
member%floodstatus(i) = 0
! fully filled elements
@@ -1869,7 +1866,7 @@ subroutine SetupMembers( InitInp, p, m, errStat, errMsg )
prop2Indx = InitInp%InpMembers(I)%MPropSetID2Indx
end if
! Now populate the various member data arrays using the HydroDyn input file data
- call SetMemberProperties( InitInp%MSL2SWL, InitInp%Gravity, p%Members(i), InitInp%InpMembers(i)%MCoefMod, InitInp%InpMembers(i)%MmbrCoefIDIndx, InitInp%InpMembers(i)%MmbrFilledIDIndx, InitInp%MPropSets(prop1Indx), InitInp%MPropSets(prop2Indx), InitInp, errStat2, errMsg2 )
+ call SetMemberProperties( InitInp%Gravity, p%Members(i), InitInp%InpMembers(i)%MCoefMod, InitInp%InpMembers(i)%MmbrCoefIDIndx, InitInp%InpMembers(i)%MmbrFilledIDIndx, InitInp%MPropSets(prop1Indx), InitInp%MPropSets(prop2Indx), InitInp, errStat2, errMsg2 )
call SetErrStat(errStat2, errMsg2, errStat, errMsg, 'SetupMembers')
if (ErrStat >= AbortErrLev) return
end do
@@ -1906,7 +1903,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
character(*), parameter :: RoutineName = 'Morison_Init'
TYPE(Morison_MemberType) :: member ! the current member
- INTEGER :: i, j, k
+ INTEGER :: i, j
REAL(ReKi) :: v2D(3,1), pos(3)
real(ReKi) :: An(3), An_drag(3), Vn(3), I_n(3), sgn, Amag, Amag_drag, Vmag, Imag, Ir_MG_end, Il_MG_end, R_I(3,3), IRl_mat(3,3), tMG, MGdens
integer(IntKi) :: MemberEndIndx
@@ -1921,18 +1918,13 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
! Define parameters here:
p%DT = Interval
- p%WtrDens = InitInp%WtrDens
- p%WtrDpth = InitInp%WtrDpth
p%Gravity = InitInp%Gravity
p%NNodes = InitInp%NNodes
p%NJoints = InitInp%NJoints
- p%NStepWave = InitInp%NStepWave
p%NumOuts = InitInp%NumOuts
p%NMOutputs = InitInp%NMOutputs ! Number of members to output [ >=0 and <10]
- p%MSL2SWL = InitInp%MSL2SWL
p%WaveDisp = InitInp%WaveDisp
p%AMMod = InitInp%AMMod
- p%WaveStMod = InitInp%WaveStMod
p%VisMeshes = InitInp%VisMeshes ! visualization mesh for morison elements
! Only compute added-mass force up to the free surface if wave stretching is enabled
@@ -1982,7 +1974,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
! Redundant work (these are already assigned to the member data arrays,
! but is needed on the joint data because we report the tMG, and MGDensity at each Joint node in the Summary File
- call SetNodeMG( InitInp%NMGDepths, InitInp%MGDepths, InitInp%Nodes(i), InitInp%MSL2SWL, InitInp%Nodes(i)%tMG, InitInp%Nodes(i)%MGDensity )
+ call SetNodeMG( InitInp%NMGDepths, InitInp%MGDepths, InitInp%Nodes(i), p%WaveField%MSL2SWL, InitInp%Nodes(i)%tMG, InitInp%Nodes(i)%MGDensity )
end do
! allocate and copy in node-based load and hydrodynamic arrays
@@ -2014,7 +2006,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
DO I=1,p%NNodes
! This needs to change so that the Position is relative to MSL NOT SWL:
pos = InitInp%Nodes(I)%Position
- pos(3) = pos(3) + InitInp%MSL2SWL
+ pos(3) = pos(3) + p%WaveField%MSL2SWL
! Create the node on the mesh
CALL MeshPositionNode (u%Mesh &
, i &
@@ -2091,7 +2083,6 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
z%DummyConstrState = 0
OtherState%DummyOtherState = 0
- m%LastIndWave = 1
! allocate and initialize joint-specific arrays
@@ -2126,7 +2117,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
tMG = -999.0
An_drag = 0.0
- IF ( (InitInp%InpJoints(i)%Position(3)-p%MSL2SWL) >= -p%WtrDpth ) THEN
+ IF ( InitInp%InpJoints(i)%Position(3) >= -InitInp%WaveField%WtrDpth ) THEN
! loop through each member attached to the joint, getting the radius of its appropriate end
DO J = 1, InitInp%InpJoints(I)%NConnections
@@ -2182,7 +2173,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
IF (EqualRealNos(Amag_drag, 0.0_ReKi)) THEN
p%DragConst_End(i) = 0.0
ELSE
- p%DragConst_End(i) = InitInp%Nodes(i)%JAxCd*p%WtrDens / ( 4.0_ReKi * Amag_drag )
+ p%DragConst_End(i) = InitInp%Nodes(i)%JAxCd*p%WaveField%WtrDens / ( 4.0_ReKi * Amag_drag )
END IF
! magnitudes of normal-weighted values
Amag = sqrt(Amag)
@@ -2192,7 +2183,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
! Constant part of the external hydrodynamic added mass term
if ( Vmag > 0.0 ) then
v2D(:,1) = Vn
- p%AM_End(:,:,i) = (InitInp%Nodes(I)%JAxCa*InitInp%WtrDens/ Vmag)*matmul(v2D, transpose(v2D))
+ p%AM_End(:,:,i) = (InitInp%Nodes(I)%JAxCa*p%WaveField%WtrDens/ Vmag)*matmul(v2D, transpose(v2D))
end if
! Constant part of the external hydrodynamic dynamic pressure force
@@ -2219,7 +2210,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
p%I_MG_End(:,:,i) = MatMul( MatMul(R_I, Irl_mat), Transpose(R_I) ) ! final moment of inertia matrix for node
- END IF ! InitInp%InpJoints(i)%Position(3) >= -p%WtrDpth
+ END IF ! InitInp%InpJoints(i)%Position(3) >= -WtrDpth
p%DragMod_End (i) = InitInp%Nodes(i)%JAxFDMod
IF ( InitInp%Nodes(i)%JAxVnCOff .LE. 0.0_ReKi) THEN
@@ -2257,7 +2248,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In
if ( errStat >= AbortErrLev ) return
! Write Summary information to *HydroDyn* summary file now that everything has been initialized.
- CALL WriteSummaryFile( InitInp%UnSum, InitInp%MSL2SWL, InitInp%NJoints, InitInp%NNodes, InitInp%Nodes, p%NMembers, p%Members, &
+ CALL WriteSummaryFile( InitInp%UnSum, InitInp%NJoints, InitInp%NNodes, InitInp%Nodes, p%NMembers, p%Members, &
p%NumOuts, p%OutParam, p%MOutLst, p%JOutLst, u%Mesh, y%Mesh, p, m, errStat2, errMsg2 )
call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName )
if ( errStat >= AbortErrLev ) return
@@ -2324,7 +2315,7 @@ subroutine VisMeshSetup(u,p,y,m,InitOut,ErrStat,ErrMsg)
Pos1=u%Mesh%Position(:,p%Members(iMem)%NodeIndx(1)) ! start node position of member
Pos2=u%Mesh%Position(:,p%Members(iMem)%NodeIndx(size(p%Members(iMem)%NodeIndx))) ! end node position of member
Theta(1) = 0.0_R8Ki ! roll (assumed since insufficient info)
- Theta(2) = acos(real((Pos2(3)-Pos1(3))/norm2(Pos2-Pos1),R8Ki)) ! pitch
+ Theta(2) = acos(real((Pos2(3)-Pos1(3))/TwoNorm(Pos2-Pos1),R8Ki)) ! pitch
Theta(3) = atan2(real(Pos2(2)-Pos1(2),R8Ki),real(Pos2(1)-Pos1(1),R8Ki)) ! yaw
MemberOrient=EulerConstructZYX(Theta) ! yaw-pitch-roll sequence
@@ -2500,83 +2491,6 @@ SUBROUTINE AllocateNodeLoadVariables(InitInp, p, m, NNodes, errStat, errMsg )
m%V_rel_n_HiPass = 0.0_ReKi
END SUBROUTINE AllocateNodeLoadVariables
-
-! !----------------------------------------------------------------------------------------------------------------------------------
-! !> This routine is similar to InterpWrappedStpReal, except it returns only the slope for the interpolation.
-! !! By returning the slope based on Time, we don't have to calculate this for every variable (Yary) we want to interpolate.
-! !! NOTE: p%WaveTime (and most arrays here) start with index of 0 instead of 1, so we will subtract 1 from "normal" interpolation
-! !! schemes.
-! FUNCTION GetInterpolationSlope(Time, p, m, IntWrapIndx) RESULT( InterpSlope )
-! REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds
-! TYPE(Morison_ParameterType), INTENT(IN ) :: p !< Parameters
-! TYPE(Morison_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables
-! INTEGER, OPTIONAL, INTENT( OUT) :: IntWrapIndx
-!
-! REAL(SiKi) :: Time_SiKi
-! REAL(SiKi) :: TimeMod
-! REAL(ReKi) :: InterpSlope
-!
-! Time_SiKi = REAL(Time, SiKi)
-! TimeMod = MOD(Time_SiKi, p%WaveTime(p%NStepWave)) !p%WaveTime starts at index 0, so it has p%NStepWave+1 elements
-! IF ( TimeMod <= p%WaveTime(1) ) THEN !second element
-! m%LastIndWave = 0
-! END IF
-!
-! IF ( TimeMod <= p%WaveTime(0) ) THEN
-! m%LastIndWave = 0
-! InterpSlope = 0.0_ReKi ! returns values at m%LastIndWave
-! IF(PRESENT(IntWrapIndx)) IntWrapIndx = 0
-! ELSE IF ( TimeMod >= p%WaveTime(p%NStepWave) ) THEN
-! m%LastIndWave = p%NStepWave-1
-! InterpSlope = 1.0_ReKi ! returns values at p%NStepWave
-! IF(PRESENT(IntWrapIndx)) IntWrapIndx = p%NStepWave
-! ELSE
-! m%LastIndWave = MAX( MIN( m%LastIndWave, p%NStepWave-1 ), 0 )
-!
-! DO
-!
-! IF ( TimeMod < p%WaveTime(m%LastIndWave) ) THEN
-!
-! m%LastIndWave = m%LastIndWave - 1
-!
-! ELSE IF ( TimeMod >= p%WaveTime(m%LastIndWave+1) ) THEN
-!
-! m%LastIndWave = m%LastIndWave + 1
-!
-! ELSE
-! IF(PRESENT(IntWrapIndx)) IntWrapIndx = m%LastIndWave
-!
-! InterpSlope = ( TimeMod - p%WaveTime(m%LastIndWave) )/( p%WaveTime(m%LastIndWave+1) - p%WaveTime(m%LastIndWave) )
-! RETURN ! stop checking DO loop
-! END IF
-!
-! END DO
-!
-! END IF
-!
-! END FUNCTION GetInterpolationSlope
-! !----------------------------------------------------------------------------------------------------------------------------------
-! !> Use in conjunction with GetInterpolationSlope, to replace InterpWrappedStpReal here.
-! FUNCTION InterpolateWithSlope(InterpSlope, Ind, YAry)
-! REAL(ReKi), INTENT(IN) :: InterpSlope
-! INTEGER(IntKi), INTENT(IN ) :: Ind !< Misc/optimization variables
-! REAL(SiKi), INTENT(IN) :: YAry(0:)
-! REAL(ReKi) :: InterpolateWithSlope
-!
-! InterpolateWithSlope = ( YAry(Ind+1) - YAry(Ind) )*InterpSlope + YAry(Ind)
-!
-! END FUNCTION InterpolateWithSlope
-! !----------------------------------------------------------------------------------------------------------------------------------
-! !> Use in conjunction with GetInterpolationSlope, to replace InterpWrappedStpReal here.
-! FUNCTION InterpolateWithSlopeR(InterpSlope, Ind, YAry)
-! REAL(ReKi), INTENT(IN) :: InterpSlope
-! INTEGER(IntKi), INTENT(IN ) :: Ind !< Misc/optimization variables
-! REAL(ReKi), INTENT(IN) :: YAry(0:)
-! REAL(ReKi) :: InterpolateWithSlopeR
-!
-! InterpolateWithSlopeR = ( YAry(Ind+1) - YAry(Ind) )*InterpSlope + YAry(Ind)
-!
-! END FUNCTION InterpolateWithSlopeR
!----------------------------------------------------------------------------------------------------------------------------------
!> Routine for computing outputs, used in both loose and tight coupling.
SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat, errMsg )
@@ -2601,7 +2515,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
character(*), parameter :: RoutineName = 'Morison_CalcOutput'
REAL(ReKi) :: vmag, vmagf
- INTEGER :: I, J, K
+ INTEGER :: I, J
REAL(ReKi) :: qdotdot(6) ! The structural acceleration of a mesh node
TYPE(Morison_MemberType) :: mem ! the current member
@@ -2628,7 +2542,6 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
REAL(ReKi) :: g ! gravity constant
REAL(ReKi) :: k_hat(3), k_hat1(3), k_hat2(3) ! Elemental unit vector pointing from 1st node to 2nd node of the element
REAL(ReKi) :: n_hat(3)
- REAL(ReKi) :: alpha ! final load distribution factor for element
REAL(ReKi) :: Fr !radial component of buoyant force
REAL(ReKi) :: Fl !axial component of buoyant force
REAL(ReKi) :: Moment !moment induced about the center of the cylinder's bottom face
@@ -2639,7 +2552,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
REAL(ReKi) :: a_s2(3)
REAL(ReKi) :: alpha_s2(3)
REAL(ReKi) :: omega_s2(3)
- REAL(ReKi) :: pos1(3), pos2(3), positionXY(2)
+ REAL(ReKi) :: pos1(3), pos2(3)
REAL(ReKi) :: Imat(3,3)
REAL(ReKi) :: iArm(3), iTerm(3), Ioffset, h_c, dRdl_p, dRdl_pp, f_hydro(3), Am(3,3), lstar, deltal, deltalLeft, deltalRight
REAL(ReKi) :: h, h_c_AM, deltal_AM
@@ -2667,7 +2580,6 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
REAL(ReKi) :: FAFSInt(3)
REAL(ReKi) :: FDynPFSInt
REAL(ReKi) :: vrelFSInt(3)
- REAL(ReKi) :: pos1Prime(3)
REAL(ReKi) :: FAMCFFSInt(3)
INTEGER(IntKi) :: MemSubStat, NumFSX
REAL(DbKi) :: theta1, theta2
@@ -2690,7 +2602,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
!===============================================================================================
! Calculate the fluid kinematics at all mesh nodes and store for use in the equations below
- CALL WaveField_GetWaveKin( p%WaveField, Time, m%DispNodePosHdn, .FALSE., m%nodeInWater, m%WaveElev1, m%WaveElev2, m%WaveElev, m%FDynP, m%FV, m%FA, m%FAMCF, ErrStat2, ErrMsg2 )
+ CALL WaveField_GetWaveKin( p%WaveField, m%SeaSt_Interp_m, Time, m%DispNodePosHdn, .FALSE., m%nodeInWater, m%WaveElev1, m%WaveElev2, m%WaveElev, m%FDynP, m%FV, m%FA, m%FAMCF, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
! Compute fluid velocity relative to the structure
DO j = 1, p%NNodes
@@ -2867,7 +2779,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/posMid(1),posMid(2),ZetaMid/) ! Reference point on the free surface
ELSE
- FSPt = (/posMid(1),posMid(2),0.0/)
+ FSPt = (/posMid(1),posMid(2),0.0_ReKi/)
n_hat = (/0.0,0.0,1.0/)
END IF
CALL GetSectionUnitVectors( k_hat, y_hat, z_hat )
@@ -3056,8 +2968,8 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
!-------------------- hydrodynamic drag loads: sides: Section 7.1.2 ------------------------!
vec = matmul( mem%Ak,m%vrel(:,mem%NodeIndx(i)) )
- f_hydro = mem%Cd(i)*p%WtrDens*mem%RMG(i)*TwoNorm(vec)*vec + &
- 0.5*mem%AxCd(i)*p%WtrDens*pi*mem%RMG(i)*dRdl_p * abs(dot_product( mem%k, m%vrel(:,mem%NodeIndx(i)) )) * matmul( mem%kkt, m%vrel(:,mem%NodeIndx(i)) )
+ f_hydro = mem%Cd(i)*p%WaveField%WtrDens*mem%RMG(i)*TwoNorm(vec)*vec + &
+ 0.5*mem%AxCd(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*dRdl_p * abs(dot_product( mem%k, m%vrel(:,mem%NodeIndx(i)) )) * matmul( mem%kkt, m%vrel(:,mem%NodeIndx(i)) )
CALL LumpDistrHydroLoads( f_hydro, mem%k, deltal, h_c, m%memberLoads(im)%F_D(:, i) )
y%Mesh%Force (:,mem%NodeIndx(i)) = y%Mesh%Force (:,mem%NodeIndx(i)) + m%memberLoads(im)%F_D(1:3, i)
y%Mesh%Moment(:,mem%NodeIndx(i)) = y%Mesh%Moment(:,mem%NodeIndx(i)) + m%memberLoads(im)%F_D(4:6, i)
@@ -3067,17 +2979,17 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
IF ( .NOT. mem%PropPot ) THEN
!-------------------- hydrodynamic added mass loads: sides: Section 7.1.3 ------------------------!
- Am = mem%Ca(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*mem%Ak + 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p*mem%kkt
+ Am = mem%Ca(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*mem%Ak + 2.0*mem%AxCa(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p*mem%kkt
f_hydro = -matmul( Am, u%Mesh%TranslationAcc(:,mem%NodeIndx(i)) )
IF ( p%AMMod .EQ. 0_IntKi ) THEN ! Compute added-mass force up to the SWL
- z1 = u%Mesh%Position(3, mem%NodeIndx(i)) - p%MSL2SWL ! Undisplaced z-position of the current node
+ z1 = u%Mesh%Position(3, mem%NodeIndx(i)) - p%WaveField%MSL2SWL ! Undisplaced z-position of the current node
IF ( z1 > 0.0_ReKi ) THEN ! Node is above SWL undisplaced; zero added-mass force
f_hydro = 0.0_ReKi
CALL LumpDistrHydroLoads( f_hydro, mem%k, deltal, h_c, m%memberLoads(im)%F_A(:, i) )
ELSE
! Need to compute deltal_AM and h_c_AM based on the formulation without wave stretching.
- z2 = u%Mesh%Position(3, mem%NodeIndx(i+1)) - p%MSL2SWL ! Undisplaced z-position of the next node
+ z2 = u%Mesh%Position(3, mem%NodeIndx(i+1)) - p%WaveField%MSL2SWL ! Undisplaced z-position of the next node
IF ( z2 > 0.0_ReKi ) THEN ! Element i crosses the SWL
h = -z1 / mem%cosPhi_ref ! Length of Element i between SWL and node i, h>=0
deltal_AM = mem%dl/2.0 + h
@@ -3101,12 +3013,12 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
!--------------------- hydrodynamic inertia loads: sides: Section 7.1.4 --------------------------!
IF (mem%PropMCF) THEN
- f_hydro= p%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FAMCF(:,mem%NodeIndx(i)) ) + &
- 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
+ f_hydro= p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FAMCF(:,mem%NodeIndx(i)) ) + &
+ 2.0*mem%AxCa(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
2.0*m%FDynP(mem%NodeIndx(i))*mem%AxCp(i)*pi*mem%RMG(i)*dRdl_pp*mem%k
ELSE
- f_hydro=(mem%Ca(i)+mem%Cp(i))*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FA(:,mem%NodeIndx(i)) ) + &
- 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
+ f_hydro=(mem%Ca(i)+mem%Cp(i))*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FA(:,mem%NodeIndx(i)) ) + &
+ 2.0*mem%AxCa(i) *p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
2.0*m%FDynP(mem%NodeIndx(i))*mem%AxCp(i)*pi*mem%RMG(i)*dRdl_pp*mem%k
END IF
@@ -3124,7 +3036,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
! Compute the distributed loads at the point of intersection between the member and the free surface !
!----------------------------------------------------------------------------------------------------!
! Get wave kinematics at the free-surface intersection. Set forceNodeInWater=.TRUE. to guarantee the free-surface intersection is in water.
- CALL WaveField_GetNodeWaveKin( p%WaveField, Time, FSInt, .TRUE., nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat2, ErrMsg2 )
+ CALL WaveField_GetNodeWaveKin( p%WaveField, m%SeaSt_Interp_m, Time, FSInt, .TRUE., nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FDynPFSInt = REAL(FDynP,ReKi)
FVFSInt = REAL(FV, ReKi)
@@ -3144,8 +3056,8 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
RMGFSInt = SubRatio * mem%RMG(FSElem+1) + (1.0-SubRatio) * mem%RMG(FSElem)
vec = matmul( mem%Ak,vrelFSInt )
- F_DS = mem%Cd(FSElem)*p%WtrDens*RMGFSInt*TwoNorm(vec)*vec + &
- 0.5*mem%AxCd(FSElem)*p%WtrDens*pi*RMGFSInt*dRdl_p * &
+ F_DS = mem%Cd(FSElem)*p%WaveField%WtrDens*RMGFSInt*TwoNorm(vec)*vec + &
+ 0.5*mem%AxCd(FSElem)*p%WaveField%WtrDens*pi*RMGFSInt*dRdl_p * &
abs(dot_product( mem%k, vrelFSInt )) * matmul( mem%kkt, vrelFSInt )
! Hydrodynamic added mass and inertia loads
@@ -3153,8 +3065,8 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
! ------------------- hydrodynamic added mass loads: sides: Section 7.1.3 ------------------------
IF (p%AMMod > 0_IntKi) THEN
- Am = mem%Ca(FSElem)*p%WtrDens*pi*RMGFSInt*RMGFSInt*mem%Ak + &
- 2.0*mem%AxCa(FSElem)*p%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p*mem%kkt
+ Am = mem%Ca(FSElem)*p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt*mem%Ak + &
+ 2.0*mem%AxCa(FSElem)*p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p*mem%kkt
F_AS = -matmul( Am, &
SubRatio * u%Mesh%TranslationAcc(:,mem%NodeIndx(FSElem+1)) + &
(1.0-SubRatio) * u%Mesh%TranslationAcc(:,mem%NodeIndx(FSElem )) )
@@ -3162,12 +3074,12 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
! ------------------- hydrodynamic inertia loads: sides: Section 7.1.4 ------------------------
IF ( mem%PropMCF) THEN
- F_IS= p%WtrDens*pi*RMGFSInt*RMGFSInt * matmul( mem%Ak, FAMCFFSInt ) + &
- 2.0*mem%AxCa(FSElem)*p%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p * matmul( mem%kkt, FAFSInt ) + &
+ F_IS= p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt * matmul( mem%Ak, FAMCFFSInt ) + &
+ 2.0*mem%AxCa(FSElem)*p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p * matmul( mem%kkt, FAFSInt ) + &
2.0*mem%AxCp(FSElem) *pi*RMGFSInt *dRdl_pp * FDynPFSInt*mem%k
ELSE
- F_IS=(mem%Ca(FSElem)+mem%Cp(FSElem))*p%WtrDens*pi*RMGFSInt*RMGFSInt * matmul( mem%Ak, FAFSInt ) + &
- 2.0*mem%AxCa(FSElem)*p%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p * matmul( mem%kkt, FAFSInt ) + &
+ F_IS=(mem%Ca(FSElem)+mem%Cp(FSElem))*p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt * matmul( mem%Ak, FAFSInt ) + &
+ 2.0*mem%AxCa(FSElem)*p%WaveField%WtrDens*pi*RMGFSInt*RMGFSInt*dRdl_p * matmul( mem%kkt, FAFSInt ) + &
2.0*mem%AxCp(FSElem) *pi*RMGFSInt *dRdl_pp * FDynPFSInt*mem%k
END IF
END IF
@@ -3336,18 +3248,18 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
!--------------------- hydrodynamic drag loads: sides: Section 7.1.2 --------------------------------!
vec = matmul( mem%Ak,m%vrel(:,mem%NodeIndx(i)) )
- f_hydro = mem%Cd(i)*p%WtrDens*mem%RMG(i)*TwoNorm(vec)*vec + &
- 0.5*mem%AxCd(i)*p%WtrDens*pi*mem%RMG(i)*dRdl_p * abs(dot_product( mem%k, m%vrel(:,mem%NodeIndx(i)) )) * matmul( mem%kkt, m%vrel(:,mem%NodeIndx(i)) )
+ f_hydro = mem%Cd(i)*p%WaveField%WtrDens*mem%RMG(i)*TwoNorm(vec)*vec + &
+ 0.5*mem%AxCd(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*dRdl_p * abs(dot_product( mem%k, m%vrel(:,mem%NodeIndx(i)) )) * matmul( mem%kkt, m%vrel(:,mem%NodeIndx(i)) )
CALL LumpDistrHydroLoads( f_hydro, mem%k, deltal, h_c, m%memberLoads(im)%F_D(:, i) )
y%Mesh%Force (:,mem%NodeIndx(i)) = y%Mesh%Force (:,mem%NodeIndx(i)) + m%memberLoads(im)%F_D(1:3, i)
y%Mesh%Moment(:,mem%NodeIndx(i)) = y%Mesh%Moment(:,mem%NodeIndx(i)) + m%memberLoads(im)%F_D(4:6, i)
IF ( .NOT. mem%PropPot ) THEN
!-------------------- hydrodynamic added mass loads: sides: Section 7.1.3 ------------------------!
- Am = mem%Ca(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*mem%Ak + 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p*mem%kkt
+ Am = mem%Ca(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*mem%Ak + 2.0*mem%AxCa(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p*mem%kkt
f_hydro = -matmul( Am, u%Mesh%TranslationAcc(:,mem%NodeIndx(i)) )
IF ( p%AMMod .EQ. 0_IntKi ) THEN ! Always compute added-mass force on nodes below SWL when undisplaced
- z1 = u%Mesh%Position(3, mem%NodeIndx(i)) - p%MSL2SWL ! Undisplaced z-position of the current node
+ z1 = u%Mesh%Position(3, mem%NodeIndx(i)) - p%WaveField%MSL2SWL ! Undisplaced z-position of the current node
IF ( z1 > 0.0_ReKi ) THEN ! Node is above SWL when undisplaced; zero added-mass force
f_hydro = 0.0_ReKi
CALL LumpDistrHydroLoads( f_hydro, mem%k, deltal, h_c, m%memberLoads(im)%F_A(:, i) )
@@ -3362,7 +3274,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
IF ( i == N+1 ) THEN
deltalRight = 0.0_ReKi
ELSE
- z2 = u%Mesh%Position(3, mem%NodeIndx(i+1)) - p%MSL2SWL
+ z2 = u%Mesh%Position(3, mem%NodeIndx(i+1)) - p%WaveField%MSL2SWL
IF ( z2 > 0.0_ReKi ) THEN ! Element i crosses the SWL
deltalRight = -z1 / mem%cosPhi_ref
ELSE
@@ -3382,12 +3294,12 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
!-------------------- hydrodynamic inertia loads: sides: Section 7.1.4 ---------------------------!
IF ( mem%PropMCF ) THEN
- f_hydro= p%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FAMCF(:,mem%NodeIndx(i)) ) + &
- 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
+ f_hydro= p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FAMCF(:,mem%NodeIndx(i)) ) + &
+ 2.0*mem%AxCa(i)*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
2.0*m%FDynP(mem%NodeIndx(i))*mem%AxCp(i)*pi*mem%RMG(i)*dRdl_pp*mem%k
ELSE
- f_hydro=(mem%Ca(i)+mem%Cp(i))*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FA(:,mem%NodeIndx(i)) ) + &
- 2.0*mem%AxCa(i)*p%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
+ f_hydro=(mem%Ca(i)+mem%Cp(i))*p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i) * matmul( mem%Ak, m%FA(:,mem%NodeIndx(i)) ) + &
+ 2.0*mem%AxCa(i) *p%WaveField%WtrDens*pi*mem%RMG(i)*mem%RMG(i)*dRdl_p * matmul( mem%kkt, m%FA(:,mem%NodeIndx(i)) ) + &
2.0*m%FDynP(mem%NodeIndx(i))*mem%AxCp(i)*pi*mem%RMG(i)*dRdl_pp*mem%k
END IF
CALL LumpDistrHydroLoads( f_hydro, mem%k, deltal, h_c, m%memberLoads(im)%F_I(:, i) )
@@ -3485,7 +3397,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos1(1),pos1(2),Zeta1/) ! Reference point on the free surface
ELSE
- FSPt = (/pos1(1),pos1(2),0.0/)
+ FSPt = (/pos1(1),pos1(2),0.0_ReKi/)
n_hat = (/0.0,0.0,1.0/)
END IF
CALL GetSectionUnitVectors( k_hat1, y_hat, z_hat )
@@ -3506,7 +3418,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos2(1),pos2(2),Zeta2/) ! Reference point on the free surface
ELSE
- FSPt = (/pos2(1),pos2(2),0.0/)
+ FSPt = (/pos2(1),pos2(2),0.0_ReKi/)
n_hat = (/0.0,0.0,1.0/)
END IF
CALL GetSectionUnitVectors( k_hat2, y_hat, z_hat )
@@ -3528,7 +3440,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos2(1),pos2(2),Zeta2/) ! Reference point on the free surface
ELSE
- FSPt = (/pos2(1),pos2(2),0.0/)
+ FSPt = (/pos2(1),pos2(2),0.0_ReKi/)
n_hat = (/0.0,0.0,1.0/)
END IF
CALL GetSectionUnitVectors( k_hat2, y_hat, z_hat )
@@ -3641,7 +3553,7 @@ SUBROUTINE GetDisplacedNodePosition( forceDisplaced, pos )
! Undisplaced node position
pos = u%Mesh%Position
- pos(3,:) = pos(3,:) - p%MSL2SWL ! Z position measured from the SWL
+ pos(3,:) = pos(3,:) - p%WaveField%MSL2SWL ! Z position measured from the SWL
IF ( (p%WaveDisp /= 0) .OR. forceDisplaced ) THEN
! Use displaced X and Y position
pos(1,:) = pos(1,:) + u%Mesh%TranslationDisp(1,:)
@@ -3666,7 +3578,7 @@ SUBROUTINE GetTotalWaveElev( Time, pos, Zeta, ErrStat, ErrMsg )
ErrStat = ErrID_None
ErrMsg = ""
- Zeta = WaveField_GetNodeTotalWaveElev( p%WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ Zeta = WaveField_GetNodeTotalWaveElev( p%WaveField, m%SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END SUBROUTINE GetTotalWaveElev
@@ -3684,7 +3596,7 @@ SUBROUTINE GetFreeSurfaceNormal( Time, pos, r, n, ErrStat, ErrMsg)
ErrStat = ErrID_None
ErrMsg = ""
- CALL WaveField_GetNodeWaveNormal( p%WaveField, Time, pos, r, n, ErrStat2, ErrMsg2 )
+ CALL WaveField_GetNodeWaveNormal( p%WaveField, m%SeaSt_Interp_m, Time, pos, r, n, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END SUBROUTINE GetFreeSurfaceNormal
@@ -3696,7 +3608,7 @@ SUBROUTINE GetSectionUnitVectors( k, y, z )
IF ( ABS(k(3)) > 0.999999_ReKi ) THEN ! k is effectively vertical
y = (/0.0,1.0,0.0/)
ELSE
- y = (/-k(2),k(1),0.0/)
+ y = (/-k(2),k(1),0.0_ReKi/)
y = y / SQRT(Dot_Product(y,y))
ENDIF
z = cross_product(k,y)
@@ -3783,7 +3695,7 @@ SUBROUTINE GetSectionHstLds( origin, pos0, k_hat, y_hat, z_hat, R, dRdl, theta1,
dFdl(1:3) = -R *dRdl*C0*k_hat + R*C1*y_hat + R*C2*z_hat
dFdl(4:6) = -R**2*dRdl*C2*y_hat + R**2*dRdl*C1*z_hat + CROSS_PRODUCT((pos0-origin),dFdl(1:3))
- dFdl = dFdl * p%WtrDens * g
+ dFdl = dFdl * p%WaveField%WtrDens * g
END SUBROUTINE GetSectionHstLds
@@ -4008,7 +3920,7 @@ SUBROUTINE GetEndPlateHstLds(pos0, k_hat, y_hat, z_hat, R, theta1, theta2, F)
! End plate force in the k_hat direction
Fk = -0.5*Z0*(R_2*dTheta-tmp1) + cosPhi/6.0*( 2.0*dy_3 - z1*z2*dy - z1_2*(y2+2.0*y1) + z2_2*(y1+2.0*y2) )
- F(1:3) = p%WtrDens * g * Fk * k_hat
+ F(1:3) = p%WaveField%WtrDens * g * Fk * k_hat
! End plate moment in the y_hat and z_hat direction
My = Z0/6.0*( 2.0*dy_3 + 2.0*dy*tmp2 + 3.0*tmp1*sz ) & ! y_hat component
@@ -4026,7 +3938,7 @@ SUBROUTINE GetEndPlateHstLds(pos0, k_hat, y_hat, z_hat, R, theta1, theta2, F)
Mz = -Z0/ 6.0*( tmp1*dz_3 + 3.0*tmp2*dz_2 + 3.0*tmp3*dz ) &
-cosPhi/24.0*(3.0*tmp1*dz_4 + 8.0*tmp2*dz_3 + 6.0*tmp3*dz_2)
END IF
- F(4:6) = p%WtrDens * g * (My*y_hat + Mz*z_hat)
+ F(4:6) = p%WaveField%WtrDens * g * (My*y_hat + Mz*z_hat)
END SUBROUTINE GetEndPlateHstLds
@@ -4072,11 +3984,11 @@ SUBROUTINE getElementHstLds_Mod1( Time, pos1, pos2, Zeta1, Zeta2, k_hat, r1, r2,
! Hydrostatic force on element
FbVec = (/0.0_ReKi,0.0_ReKi,Vs/) - Pi*( r2*r2*z2 - r1*r1*z1) *k_hat
- FbVec = p%WtrDens * g * FbVec
+ FbVec = p%WaveField%WtrDens * g * FbVec
! Hydrostatic moment on element about the lower node
MbVec = (Vhc+0.25*Pi*(r2**4-r1**4)) * Cross_Product(k_hat,(/0.0_ReKi,0.0_ReKi,1.0_ReKi/))
- MbVec = p%WtrDens * g * MbVec
+ MbVec = p%WaveField%WtrDens * g * MbVec
! Distribute element load to nodes
alpha = alphaIn*(z2-Zeta2)**pwr/(alphaIn*(z2-Zeta2)**pwr+(1.0_ReKi-alphaIn)*(z1-Zeta1)**pwr)
@@ -4100,7 +4012,7 @@ SUBROUTINE getElementHstLds_Mod1( Time, pos1, pos2, Zeta1, Zeta2, k_hat, r1, r2,
! Scaled radius of element at point where its centerline crosses the waterplane
rh = r1 + h0*dRdl
! Estimate the free-surface normal at the free-surface intersection, n_hat
- IF ( p%WaveStMod > 0_IntKi ) THEN ! If wave stretching is enabled, compute free surface normal
+ 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 SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
ELSE ! Without wave stretching, use the normal of the SWL
@@ -4162,13 +4074,13 @@ SUBROUTINE getElementHstLds_Mod1( Time, pos1, pos2, Zeta1, Zeta2, k_hat, r1, r2,
! Hydrostatic force on element
FbVec = (/0.0_ReKi,0.0_ReKi,Vs/) - Pi*a0b0*Z0*n_hat + Pi*r1**2*z1*k_hat
- FbVec = p%WtrDens * g * FbVec
+ FbVec = p%WaveField%WtrDens * g * FbVec
! Hydrostatic moment on element about the lower node
MbVec = Cross_Product( Vrc*r_hat+Vhc*k_hat, (/0.0_ReKi,0.0_ReKi,1.0_ReKi/) ) &
+ 0.25*Pi*a0b0* ( ( s_hat(3)*a0*a0 + 4.0*(s0-h0*sinGamma)*Z0 )*t_hat - t_hat(3)*b0*b0*s_hat ) &
- 0.25*Pi*r1**4*( r_hat(3) *t_hat - t_hat(3) * r_hat )
- MbVec = p%WtrDens * g * MbVec
+ MbVec = p%WaveField%WtrDens * g * MbVec
IF ( Is1stElement ) THEN ! This is the 1st element of the member
! Assign the element load to the lower (1st) node of the member
@@ -4293,13 +4205,13 @@ SUBROUTINE Morison_UpdateDiscState( Time, u, p, x, xd, z, OtherState, m, errStat
pos(2) = u%Mesh%TranslationDisp(2,J) + u%Mesh%Position(2,J)
END IF
IF (p%WaveStMod > 0 .AND. p%WaveDisp /= 0) THEN ! Wave stretching enabled
- pos(3) = u%Mesh%Position(3,J) + u%Mesh%TranslationDisp(3,J) - p%MSL2SWL ! Use the current Z location.
+ pos(3) = u%Mesh%Position(3,J) + u%Mesh%TranslationDisp(3,J) - p%WaveField%MSL2SWL ! Use the current Z location.
ELSE ! Wave stretching disabled
- pos(3) = u%Mesh%Position(3,J) - p%MSL2SWL ! We are intentionally using the undisplaced Z position of the node.
+ pos(3) = u%Mesh%Position(3,J) - p%WaveField%MSL2SWL ! We are intentionally using the undisplaced Z position of the node.
END IF
! Get fluid velocity at the joint
- CALL WaveField_GetNodeWaveVel( p%WaveField, Time, pos, .FALSE., nodeInWater, FVTmp, ErrStat2, ErrMsg2 )
+ CALL WaveField_GetNodeWaveVel( p%WaveField, m%SeaSt_Interp_m, Time, pos, .FALSE., nodeInWater, FVTmp, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FV = REAL(FVTmp, ReKi)
vrel = ( FV - u%Mesh%TranslationVel(:,J) ) * nodeInWater
diff --git a/modules/hydrodyn/src/Morison.txt b/modules/hydrodyn/src/Morison.txt
index 38dc16137a..7b4b426647 100644
--- a/modules/hydrodyn/src/Morison.txt
+++ b/modules/hydrodyn/src/Morison.txt
@@ -225,9 +225,6 @@ typedef ^ ^ INTEGER
# e.g., the name of the input file, the file root name,etc.
#
typedef ^ InitInputType ReKi Gravity - - - "Gravity (scalar, positive-valued)" m/s^2
-typedef ^ ^ ReKi WtrDens - - - "Water density" kg/m^3
-typedef ^ ^ ReKi WtrDpth - - - "Water depth (positive-valued)" m
-typedef ^ ^ ReKi MSL2SWL - - - "Mean Sea Level to Still Water Level offset" m
typedef ^ ^ INTEGER WaveDisp - - - "Method of computing Wave Kinematics. (0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) " -
typedef ^ ^ INTEGER AMMod - - - "Method of computing distributed added-mass force. (0: Only and always on nodes below SWL at the undisplaced position. 1: Up to the instantaneous free surface) [overwrite to 0 when WaveMod = 0 or 6 or when WaveStMod = 0 in SeaState]" -
typedef ^ ^ INTEGER NJoints - - - "Number of user-specified joints" -
@@ -272,9 +269,6 @@ typedef ^ ^ Morison_JOu
typedef ^ ^ CHARACTER(ChanLen) OutList {:} - - "This list size needs to be the maximum # of possible outputs because of the use of ReadAry(). Use MaxMrsnOutputs" -
typedef ^ ^ INTEGER NumOuts - - - "" -
typedef ^ ^ INTEGER UnSum - - - "" -
-typedef ^ ^ INTEGER NStepWave - - - "" -
-typedef ^ ^ INTEGER WaveStMod - - - "" -
-typedef ^ ^ SiKi MCFD - - - "Diameter of the MacCamy-Fuchs member." -
typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
typedef ^ ^ logical VisMeshes - .false. - "Output visualization meshes" -
#
@@ -328,8 +322,8 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi F_BF_End {:}{:} - - "" -
typedef ^ ^ ReKi V_rel_n {:} - - "Normal relative flow velocity at joints" m/s
typedef ^ ^ ReKi V_rel_n_HiPass {:} - - "High-pass filtered normal relative flow velocity at joints" m/s
-typedef ^ ^ INTEGER LastIndWave - - - "Last time index used in the wave kinematics arrays" -
typedef ^ ^ MeshMapType VisMeshMap - - - "Mesh mapping for visualization mesh" -
+typedef ^ ^ SeaSt_Interp_MiscVarType SeaSt_Interp_m - - - "misc var information from the SeaState Interpolation module" -
# ..... Parameters ................................................................................................................
# Define parameters here:
@@ -337,9 +331,6 @@ typedef ^ ^ MeshMapType
#
typedef ^ ParameterType DbKi DT - - - "Time step for continuous state integration & discrete state update" (sec)
typedef ^ ^ ReKi Gravity - - - "Gravity (scalar, positive-valued)" m/s^2
-typedef ^ ^ ReKi WtrDens - - - "Water density" kg/m^3
-typedef ^ ^ ReKi WtrDpth - - - "Water depth (positive-valued)" m
-typedef ^ ^ ReKi MSL2SWL - - - "Mean Sea Level to Still Water Level offset" m
typedef ^ ^ INTEGER WaveDisp - - - "Method of computing Wave Kinematics. (0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) " -
typedef ^ ^ INTEGER AMMod - - - "Method of computing distributed added-mass force. (0: Only and always on nodes below SWL at the undisplaced position. 1: Up to the instantaneous free surface) [overwrite to 0 when WaveMod = 0 or 6 or when WaveStMod = 0 in SeaState]" -
typedef ^ ^ INTEGER NMembers - - - "number of members" -
@@ -356,7 +347,6 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi DP_Const_End {:}{:} - - "Constant part of Joint dynamic pressure term" N
typedef ^ ^ ReKi Mass_MG_End {:} - - "Joint marine growth mass" kg
typedef ^ ^ ReKi AM_End {:}{:}{:} - - "3x3 Joint added mass matrix, constant for all t" N
-typedef ^ ^ INTEGER NStepWave - - - "" -
typedef ^ ^ INTEGER NMOutputs - - - "" -
typedef ^ ^ Morison_MOutput MOutLst {:} - - "" -
typedef ^ ^ INTEGER NJOutputs - - - "" -
diff --git a/modules/hydrodyn/src/Morison_Types.f90 b/modules/hydrodyn/src/Morison_Types.f90
index 4afa3ffc65..5bff26944f 100644
--- a/modules/hydrodyn/src/Morison_Types.f90
+++ b/modules/hydrodyn/src/Morison_Types.f90
@@ -288,9 +288,6 @@ MODULE Morison_Types
! ========= Morison_InitInputType =======
TYPE, PUBLIC :: Morison_InitInputType
REAL(ReKi) :: Gravity = 0.0_ReKi !< Gravity (scalar, positive-valued) [m/s^2]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density [kg/m^3]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth (positive-valued) [m]
- REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Mean Sea Level to Still Water Level offset [m]
INTEGER(IntKi) :: WaveDisp = 0_IntKi !< Method of computing Wave Kinematics. (0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [-]
INTEGER(IntKi) :: AMMod = 0_IntKi !< Method of computing distributed added-mass force. (0: Only and always on nodes below SWL at the undisplaced position. 1: Up to the instantaneous free surface) [overwrite to 0 when WaveMod = 0 or 6 or when WaveStMod = 0 in SeaState] [-]
INTEGER(IntKi) :: NJoints = 0_IntKi !< Number of user-specified joints [-]
@@ -335,9 +332,6 @@ MODULE Morison_Types
CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: OutList !< This list size needs to be the maximum # of possible outputs because of the use of ReadAry(). Use MaxMrsnOutputs [-]
INTEGER(IntKi) :: NumOuts = 0_IntKi !< [-]
INTEGER(IntKi) :: UnSum = 0_IntKi !< [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< [-]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< [-]
- REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of the MacCamy-Fuchs member. [-]
TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to SeaState wave field [-]
LOGICAL :: VisMeshes = .false. !< Output visualization meshes [-]
END TYPE Morison_InitInputType
@@ -391,17 +385,14 @@ MODULE Morison_Types
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_BF_End !< [-]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: V_rel_n !< Normal relative flow velocity at joints [m/s]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: V_rel_n_HiPass !< High-pass filtered normal relative flow velocity at joints [m/s]
- INTEGER(IntKi) :: LastIndWave = 0_IntKi !< Last time index used in the wave kinematics arrays [-]
TYPE(MeshMapType) :: VisMeshMap !< Mesh mapping for visualization mesh [-]
+ TYPE(SeaSt_Interp_MiscVarType) :: SeaSt_Interp_m !< misc var information from the SeaState Interpolation module [-]
END TYPE Morison_MiscVarType
! =======================
! ========= Morison_ParameterType =======
TYPE, PUBLIC :: Morison_ParameterType
REAL(DbKi) :: DT = 0.0_R8Ki !< Time step for continuous state integration & discrete state update [(sec)]
REAL(ReKi) :: Gravity = 0.0_ReKi !< Gravity (scalar, positive-valued) [m/s^2]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density [kg/m^3]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth (positive-valued) [m]
- REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Mean Sea Level to Still Water Level offset [m]
INTEGER(IntKi) :: WaveDisp = 0_IntKi !< Method of computing Wave Kinematics. (0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [-]
INTEGER(IntKi) :: AMMod = 0_IntKi !< Method of computing distributed added-mass force. (0: Only and always on nodes below SWL at the undisplaced position. 1: Up to the instantaneous free surface) [overwrite to 0 when WaveMod = 0 or 6 or when WaveStMod = 0 in SeaState] [-]
INTEGER(IntKi) :: NMembers = 0_IntKi !< number of members [-]
@@ -418,7 +409,6 @@ MODULE Morison_Types
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: DP_Const_End !< Constant part of Joint dynamic pressure term [N]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Mass_MG_End !< Joint marine growth mass [kg]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AM_End !< 3x3 Joint added mass matrix, constant for all t [N]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< [-]
INTEGER(IntKi) :: NMOutputs = 0_IntKi !< [-]
TYPE(Morison_MOutput) , DIMENSION(:), ALLOCATABLE :: MOutLst !< [-]
INTEGER(IntKi) :: NJOutputs = 0_IntKi !< [-]
@@ -3500,9 +3490,6 @@ subroutine Morison_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, E
ErrStat = ErrID_None
ErrMsg = ''
DstInitInputData%Gravity = SrcInitInputData%Gravity
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
- DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL
DstInitInputData%WaveDisp = SrcInitInputData%WaveDisp
DstInitInputData%AMMod = SrcInitInputData%AMMod
DstInitInputData%NJoints = SrcInitInputData%NJoints
@@ -3723,9 +3710,6 @@ subroutine Morison_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, E
end if
DstInitInputData%NumOuts = SrcInitInputData%NumOuts
DstInitInputData%UnSum = SrcInitInputData%UnSum
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
- DstInitInputData%WaveStMod = SrcInitInputData%WaveStMod
- DstInitInputData%MCFD = SrcInitInputData%MCFD
DstInitInputData%WaveField => SrcInitInputData%WaveField
DstInitInputData%VisMeshes = SrcInitInputData%VisMeshes
end subroutine
@@ -3855,9 +3839,6 @@ subroutine Morison_PackInitInput(Buf, Indata)
logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%MSL2SWL)
call RegPack(Buf, InData%WaveDisp)
call RegPack(Buf, InData%AMMod)
call RegPack(Buf, InData%NJoints)
@@ -3994,9 +3975,6 @@ subroutine Morison_PackInitInput(Buf, Indata)
end if
call RegPack(Buf, InData%NumOuts)
call RegPack(Buf, InData%UnSum)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%WaveStMod)
- call RegPack(Buf, InData%MCFD)
call RegPack(Buf, associated(InData%WaveField))
if (associated(InData%WaveField)) then
call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
@@ -4021,12 +3999,6 @@ subroutine Morison_UnPackInitInput(Buf, OutData)
if (Buf%ErrStat /= ErrID_None) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MSL2SWL)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveDisp)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%AMMod)
@@ -4270,12 +4242,6 @@ subroutine Morison_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%UnSum)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MCFD)
- if (RegCheckErr(Buf, RoutineName)) return
if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -4890,10 +4856,12 @@ subroutine Morison_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg)
end if
DstMiscData%V_rel_n_HiPass = SrcMiscData%V_rel_n_HiPass
end if
- DstMiscData%LastIndWave = SrcMiscData%LastIndWave
call NWTC_Library_CopyMeshMapType(SrcMiscData%VisMeshMap, DstMiscData%VisMeshMap, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
+ call SeaSt_Interp_CopyMisc(SrcMiscData%SeaSt_Interp_m, DstMiscData%SeaSt_Interp_m, CtrlCode, ErrStat2, ErrMsg2)
+ call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
+ if (ErrStat >= AbortErrLev) return
end subroutine
subroutine Morison_DestroyMisc(MiscData, ErrStat, ErrMsg)
@@ -4975,6 +4943,8 @@ 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_Interp_DestroyMisc(MiscData%SeaSt_Interp_m, ErrStat2, ErrMsg2)
+ call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
end subroutine
subroutine Morison_PackMisc(Buf, Indata)
@@ -5088,8 +5058,8 @@ subroutine Morison_PackMisc(Buf, Indata)
call RegPackBounds(Buf, 1, lbound(InData%V_rel_n_HiPass), ubound(InData%V_rel_n_HiPass))
call RegPack(Buf, InData%V_rel_n_HiPass)
end if
- call RegPack(Buf, InData%LastIndWave)
call NWTC_Library_PackMeshMapType(Buf, InData%VisMeshMap)
+ call SeaSt_Interp_PackMisc(Buf, InData%SeaSt_Interp_m)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -5383,9 +5353,8 @@ subroutine Morison_UnPackMisc(Buf, OutData)
call RegUnpack(Buf, OutData%V_rel_n_HiPass)
if (RegCheckErr(Buf, RoutineName)) return
end if
- call RegUnpack(Buf, OutData%LastIndWave)
- if (RegCheckErr(Buf, RoutineName)) return
call NWTC_Library_UnpackMeshMapType(Buf, OutData%VisMeshMap) ! VisMeshMap
+ call SeaSt_Interp_UnpackMisc(Buf, OutData%SeaSt_Interp_m) ! SeaSt_Interp_m
end subroutine
subroutine Morison_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
@@ -5403,9 +5372,6 @@ subroutine Morison_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrM
ErrMsg = ''
DstParamData%DT = SrcParamData%DT
DstParamData%Gravity = SrcParamData%Gravity
- DstParamData%WtrDens = SrcParamData%WtrDens
- DstParamData%WtrDpth = SrcParamData%WtrDpth
- DstParamData%MSL2SWL = SrcParamData%MSL2SWL
DstParamData%WaveDisp = SrcParamData%WaveDisp
DstParamData%AMMod = SrcParamData%AMMod
DstParamData%NMembers = SrcParamData%NMembers
@@ -5547,7 +5513,6 @@ subroutine Morison_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrM
end if
DstParamData%AM_End = SrcParamData%AM_End
end if
- DstParamData%NStepWave = SrcParamData%NStepWave
DstParamData%NMOutputs = SrcParamData%NMOutputs
if (allocated(SrcParamData%MOutLst)) then
LB(1:1) = lbound(SrcParamData%MOutLst)
@@ -5694,9 +5659,6 @@ subroutine Morison_PackParam(Buf, Indata)
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, InData%DT)
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%MSL2SWL)
call RegPack(Buf, InData%WaveDisp)
call RegPack(Buf, InData%AMMod)
call RegPack(Buf, InData%NMembers)
@@ -5761,7 +5723,6 @@ subroutine Morison_PackParam(Buf, Indata)
call RegPackBounds(Buf, 3, lbound(InData%AM_End), ubound(InData%AM_End))
call RegPack(Buf, InData%AM_End)
end if
- call RegPack(Buf, InData%NStepWave)
call RegPack(Buf, InData%NMOutputs)
call RegPack(Buf, allocated(InData%MOutLst))
if (allocated(InData%MOutLst)) then
@@ -5819,12 +5780,6 @@ subroutine Morison_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MSL2SWL)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveDisp)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%AMMod)
@@ -5990,8 +5945,6 @@ subroutine Morison_UnPackParam(Buf, OutData)
call RegUnpack(Buf, OutData%AM_End)
if (RegCheckErr(Buf, RoutineName)) return
end if
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NMOutputs)
if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%MOutLst)) deallocate(OutData%MOutLst)
diff --git a/modules/hydrodyn/src/SS_Excitation.f90 b/modules/hydrodyn/src/SS_Excitation.f90
index 145cdb37e5..9cc0bf72ff 100644
--- a/modules/hydrodyn/src/SS_Excitation.f90
+++ b/modules/hydrodyn/src/SS_Excitation.f90
@@ -101,7 +101,7 @@ function GetWaveElevation ( time, u_in, t_in, p, m, ErrStat, ErrMsg )
if (p%ExctnDisp == 0) then
- GetWaveElevation = InterpWrappedStpReal ( real(time, SiKi), p%WaveTime(:), p%WaveElev0(:), m%LastIndWave, p%NStepWave + 1 )
+ GetWaveElevation = InterpWrappedStpReal ( real(time, SiKi), p%WaveField%WaveTime, p%WaveField%WaveElev0, m%LastIndWave, p%WaveField%NStepWave + 1 )
else
call SS_Exc_CopyInput(u_in(1), u_out, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) ! allocates arrays so that SS_Exc_Input_ExtrapInterp will work
@@ -111,7 +111,7 @@ function GetWaveElevation ( time, u_in, t_in, p, m, ErrStat, ErrMsg )
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
do iBody = 1, p%NBody
- GetWaveElevation(iBody) = SeaSt_Interp_3D( time, u_out%PtfmPos(1:2,iBody), p%WaveElev1, p%SeaSt_interp_p, m%SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ GetWaveElevation(iBody) = SeaSt_Interp_3D( time, u_out%PtfmPos(1:2,iBody), p%WaveField%WaveElev1, p%WaveField%SeaSt_interp_p, m%SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
end do
@@ -153,10 +153,12 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
INTEGER :: Nlines ! Number of lines in the input file, used to determine N
INTEGER :: UnSS ! I/O unit number for the WAMIT output file with the .ss extension; this file contains the state-space matrices.
INTEGER :: Sttus ! Error in reading .ssexctn file
- real(ReKi) :: WaveDir ! Temp wave direction angle (deg)
+ real(SiKi) :: WaveDir ! Temp wave direction angle (deg)
character(3) :: bodystr
integer :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
+ character(1024) :: InFile
+ character(*), parameter :: RoutineName = 'SS_Exc_Init'
! Initialize ErrStat
ErrStat = ErrID_None
@@ -166,12 +168,19 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
UnSS = -1
p%numStates = 0
+
+ ! Set wave field data and parameters from InitInp:
+ p%WaveField => InitInp%WaveField
+
+ p%ExctnDisp = InitInp%ExctnDisp
p%NBody = InitInp%NBody ! Number of WAMIT bodies: =1 if WAMIT is using NBodyMod > 1, >=1 if NBodyMod=1
+
! Open the .ss input file!
+ InFile = TRIM(InitInp%InputFile)//'.ssexctn'
CALL GetNewUnit( UnSS )
- CALL OpenFInpFile ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', ErrStat2, ErrMsg2 ) ! Open file.
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL OpenFInpFile ( UnSS, TRIM(InFile), ErrStat2, ErrMsg2 ) ! Open file.
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF (ErrStat >= AbortErrLev) THEN
CALL CleanUp()
RETURN
@@ -180,24 +189,24 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
! Determine the number of states and size of the matrices
Nlines = 1
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Header',ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadCom ( UnSS, InFile, 'Header',ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
- CALL ReadVar( UnSS,TRIM(InitInp%InputFile)//'.ssexctn', WaveDir, 'WaveDir', 'Wave direction (deg)',ErrStat2, ErrMsg2) ! Reads in the second line, containing the wave direction
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadVar( UnSS,InFile, WaveDir, 'WaveDir', 'Wave direction (deg)',ErrStat2, ErrMsg2) ! Reads in the second line, containing the wave direction
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
! Check that excitation state-space file Beta angle (in degrees) matches the HydroDyn input file angle
- if ( .not. EqualRealNos(InitInp%WaveDir, WaveDir) ) call SetErrStat(ErrID_FATAL,'HydroDyn Wave direction does not match the wave excitation wave direction',ErrStat,ErrMsg,'SS_Exc_Init')
+ if ( .not. EqualRealNos(InitInp%WaveField%WaveDir, WaveDir) ) call SetErrStat(ErrID_FATAL,'HydroDyn Wave direction does not match the wave excitation wave direction',ErrStat,ErrMsg,RoutineName)
- CALL ReadVar( UnSS,TRIM(InitInp%InputFile)//'.ssexctn', p%Tc, 'p%Tc', 'Time offset (s)',ErrStat2, ErrMsg2) ! Reads in the third line, containing the number of states
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadVar( UnSS,InFile, p%Tc, 'p%Tc', 'Time offset (s)',ErrStat2, ErrMsg2) ! Reads in the third line, containing the number of states
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
- CALL ReadVar( UnSS,TRIM(InitInp%InputFile)//'.ssexctn', p%numStates, 'p%numStates', 'Number of states',ErrStat2, ErrMsg2) ! Reads in the third line, containing the number of states
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadVar( UnSS,InFile, p%numStates, 'p%numStates', 'Number of states',ErrStat2, ErrMsg2) ! Reads in the third line, containing the number of states
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
- call AllocAry( p%spdof, 6*p%NBody, 'p%spdof', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Rad_Init')
- CALL ReadAry( UnSS,TRIM(InitInp%InputFile)//'.ssexctn', p%spDOF, 6*p%NBody, 'p%spDOF', 'States per DOF',ErrStat2, ErrMsg2)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ call AllocAry( p%spdof, 6*p%NBody, 'p%spdof', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+ CALL ReadAry( UnSS,InFile, p%spDOF, 6*p%NBody, 'p%spDOF', 'States per DOF',ErrStat2, ErrMsg2)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF (ErrStat >= AbortErrLev) THEN
CALL CleanUp()
@@ -205,7 +214,7 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
END IF
DO !Loop through all the lines of the file
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Header',Sttus,ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Header',Sttus,ErrMsg2 )! Reads the first entire line (Title header)
IF ( Sttus == ErrID_None ) THEN ! .TRUE. when data is read in successfully
Nlines=Nlines+1
ELSE !We must have reached the end of the file
@@ -217,7 +226,7 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
!Verifications on the input file
IF ( ( Nlines - 6*p%NBody ) / 2 /= p%numStates) THEN
- CALL SetErrStat(ErrID_Severe,'Error in the input file .ssexctn: The size of the matrices does not correspond to the number of states!',ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL SetErrStat(ErrID_Severe,'Error in the input file .ssexctn: The size of the matrices does not correspond to the number of states!',ErrStat,ErrMsg,RoutineName)
END IF
@@ -228,9 +237,9 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
! Now we can allocate the temporary matrices A, B and C
- CALL AllocAry( p%A, p%numStates, p%numStates, 'p%A', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
- CALL AllocAry( p%B, p%numStates, 'p%B', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
- CALL AllocAry( p%C, 6*p%NBody, p%numStates, 'p%C', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL AllocAry( p%A, p%numStates, p%numStates, 'p%A', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+ CALL AllocAry( p%B, p%numStates, 'p%B', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+ CALL AllocAry( p%C, 6*p%NBody, p%numStates, 'p%C', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF (ErrStat >= AbortErrLev) THEN
CALL CleanUp()
@@ -241,25 +250,25 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
REWIND (UNIT=UnSS) ! REWIND the file so we can read it in a second time.
! Skip the first 4 lines: (NOTE: no error handling here because we would have caught it the first time through)
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Header', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Wave direction (deg)', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Time offset (s)', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Number of Excitation States', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- CALL ReadCom ( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', 'Number of states per dofs', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Header', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Wave direction (deg)', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Time offset (s)', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Number of Excitation States', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
+ CALL ReadCom ( UnSS, InFile, 'Number of states per dofs', ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
DO I = 1,p%numStates !Read A MatriX
- CALL ReadAry( UnSS,TRIM(InitInp%InputFile)//'.ssexctn', p%A(I,:), p%numStates, 'p%A', 'A_Matrix',ErrStat2, ErrMsg2)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadAry( UnSS,InFile, p%A(I,:), p%numStates, 'p%A', 'A_Matrix',ErrStat2, ErrMsg2)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
END DO
DO I = 1,p%numStates !Read B Matrix
- CALL ReadVar( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', p%B(I), 'p%B', 'B_Matrix',ErrStat2, ErrMsg2)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadVar( UnSS, InFile, p%B(I), 'p%B', 'B_Matrix',ErrStat2, ErrMsg2)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
END DO
DO I = 1,6*p%NBody !Read C Matrix
- CALL ReadAry( UnSS, TRIM(InitInp%InputFile)//'.ssexctn', p%C(I,:), p%numStates, 'p%C', 'C_Matrix',ErrStat2, ErrMsg2)
- CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL ReadAry( UnSS, InFile, p%C(I,:), p%numStates, 'p%C', 'C_Matrix',ErrStat2, ErrMsg2)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
END DO
CLOSE ( UnSS ) !Close .ss input file
UnSS = -1 ! Indicate the file is closed
@@ -273,35 +282,10 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
p%DT = Interval
- ! Allocate Wave-elevation related arrays
- p%NStepWave = InitInp%NStepWave
- !allocate ( p%WaveElev0(0:p%NStepWave) , STAT=ErrStat2 )
- !IF (ErrStat2 /= 0) THEN
- ! CALL SetErrStat(ErrID_Fatal,'Error allocating p%WaveElev0 array',ErrStat,ErrMsg,'SS_Exc_Init')
- !end if
- !allocate ( p%WaveTime (0:p%NStepWave) , STAT=ErrStat2 )
- !IF (ErrStat2 /= 0) THEN
- ! CALL SetErrStat(ErrID_Fatal,'Error allocating p%WaveTime array',ErrStat,ErrMsg,'SS_Exc_Init')
- !end if
- !
- !IF (ErrStat >= AbortErrLev) THEN
- ! CALL CleanUp()
- ! RETURN
- !END IF
- p%SeaSt_Interp_p = InitInp%SeaSt_Interp_p
- p%ExctnDisp = InitInp%ExctnDisp
- p%WaveTime => InitInp%WaveTime
- p%ExctnDisp = InitInp%ExctnDisp
- if (p%ExctnDisp == 0) then
- ! call MOVE_ALLOC(InitInp%WaveElev0, p%WaveElev0)
- p%WaveElev0 => InitInp%WaveElev0
- else
- p%WaveElev1 => InitInp%WaveElev1
- end if
! Define initial system states here:
- CALL AllocAry( x%x, p%numStates, 'x%x', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL AllocAry( x%x, p%numStates, 'x%x', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF (ErrStat >= AbortErrLev) THEN
CALL CleanUp()
RETURN
@@ -314,7 +298,7 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
! Define other States:
DO I=1,SIZE(OtherState%xdot)
- CALL SS_Exc_CopyContState( x, OtherState%xdot(i), MESH_NEWCOPY, ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ CALL SS_Exc_CopyContState( x, OtherState%xdot(i), MESH_NEWCOPY, ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
END DO
OtherState%n = -1
@@ -325,17 +309,17 @@ SUBROUTINE SS_Exc_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Ini
! no inputs
! Define system output initializations (set up mesh) here:
- call AllocAry( y%y, p%NBody*6, 'y%y', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Exc_Init')
+ call AllocAry( y%y, p%NBody*6, 'y%y', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
y%y = 0
- call AllocAry( y%WriteOutput, 6*p%NBody+1, 'y%WriteOutput', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Rad_Init')
+ call AllocAry( y%WriteOutput, 6*p%NBody+1, 'y%WriteOutput', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
y%WriteOutput = 0
! Define initialization-routine output here:
! For OpenFAST, these outputs are attached (via HydroDyn) to the Radiation Force/Moment channels within HydroDyn
- call AllocAry( InitOut%WriteOutputHdr, 6*p%NBody+1, 'InitOut%WriteOutputHdr', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Rad_Init')
- call AllocAry( InitOut%WriteOutputUnt, 6*p%NBody+1, 'InitOut%WriteOutputUnt', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Rad_Init')
+ call AllocAry( InitOut%WriteOutputHdr, 6*p%NBody+1, 'InitOut%WriteOutputHdr', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+ call AllocAry( InitOut%WriteOutputUnt, 6*p%NBody+1, 'InitOut%WriteOutputUnt', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
InitOut%WriteOutputHdr(1) = 'Time'
InitOut%WriteOutputUnt(1) = '(s) '
do i = 1, p%NBody
diff --git a/modules/hydrodyn/src/SS_Excitation.txt b/modules/hydrodyn/src/SS_Excitation.txt
index 59986becaf..f5b9311d60 100644
--- a/modules/hydrodyn/src/SS_Excitation.txt
+++ b/modules/hydrodyn/src/SS_Excitation.txt
@@ -15,17 +15,15 @@
# URL: $HeadURL$
###################################################################################################################################
usefrom SeaState_Interp.txt
+usefrom SeaSt_WaveField.txt
typedef SS_Excitation/SS_Exc InitInputType CHARACTER(1024) InputFile - - - "Name of the input file" -
typedef ^ ^ IntKi NBody - - - "Number of WAMIT bodies for this State Space model" -
typedef ^ ^ IntKi ExctnDisp - - - "0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0]" -
-typedef ^ ^ ReKi WaveDir - - - "Wave direction" rad
-typedef ^ ^ INTEGER NStepWave - - - "Number of timesteps in the WaveTime array" -
typedef ^ ^ R8Ki PtfmRefztRot {:} - - "The rotation about zt of the body reference frame(s) from xt/yt" radians
-typedef ^ ^ SiKi WaveElev0 {*} - - "Wave elevation time history at origin" m
-typedef ^ ^ SiKi WaveElev1 {*}{*}{*} - - "First order wave elevation (points to SeaState module data)" -
-typedef ^ ^ SiKi WaveTime {*} - - "Times where wave elevation is known (points to SeaState module data)" s
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
+
+
typedef ^ InitOutputType CHARACTER(10) WriteOutputHdr {:} - - "Header of the output" -
typedef ^ InitOutputType CHARACTER(10) WriteOutputUnt {:} - - "Units of the output" -
@@ -56,17 +54,13 @@ typedef ^ ^ SeaSt_Interp_MiscVarType
typedef ^ ParameterType DbKi DT - - - "Time step" s
typedef ^ ^ IntKi NBody - - - "Number of WAMIT bodies for this State Space model" -
typedef ^ ^ IntKi ExctnDisp - - - "0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0]" -
-typedef ^ ^ INTEGER NStepWave - - - "Number of timesteps in the WaveTime array" -
typedef ^ ^ IntKi spDOF {:} - - "States per DOF" -
typedef ^ ^ ReKi A {:}{:} - - "A matrix" -
typedef ^ ^ ReKi B {:} - - "B matrix" -
typedef ^ ^ ReKi C {:}{:} - - "C matrix" -
typedef ^ ^ INTEGER numStates - 0 - "Number of states" -
typedef ^ ^ DbKi Tc - - - "Time shift" s
-typedef ^ ^ SiKi WaveElev0 {*} - - "Wave elevation time history at origin" m
-typedef ^ ^ SiKi WaveElev1 {*}{*}{*} - - "First order wave elevation (points to SeaState module data)" -
-typedef ^ ^ SiKi WaveTime {*} - - "Times where wave elevation is known (points to SeaState module data)" s
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to SeaState wave field" -
# ..... Inputs .............................
# Define inputs that are contained on the mesh here:
diff --git a/modules/hydrodyn/src/SS_Excitation_Driver.f90 b/modules/hydrodyn/src/SS_Excitation_Driver.f90
deleted file mode 100644
index 985ac09210..0000000000
--- a/modules/hydrodyn/src/SS_Excitation_Driver.f90
+++ /dev/null
@@ -1,299 +0,0 @@
-!**********************************************************************************************************************************
-! SS_Excitation_Driver: This code tests the SS_Excitation module
-!..................................................................................................................................
-! LICENSING
-! Copyright (C) 2018 National Renewable Energy Laboratory
-!
-! This file is part of SS_Excitation.
-!
-! Licensed under the Apache License, Version 2.0 (the "License");
-! you may not use this file except in compliance with the License.
-! You may obtain a copy of the License at
-!
-! http://www.apache.org/licenses/LICENSE-2.0
-!
-! Unless required by applicable law or agreed to in writing, software
-! distributed under the License is distributed on an "AS IS" BASIS,
-! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-! See the License for the specific language governing permissions and
-!
-!**********************************************************************************************************************************
-PROGRAM SS_Excitation_Driver
-
- USE NWTC_Library
- USE SS_Excitation
- USE SS_Excitation_Types
-
- IMPLICIT NONE
-
- ! Program variables
-
- REAL(DbKi) :: Time ! Variable for storing time, in seconds
- REAL(DbKi) :: waveDT
- !REAL(DbKi) :: Time2(145201,1) ! Variable for storing time, in seconds
- !REAL(DbKi) :: tdq(145201,7) ! Variable for storing time and body velocities, in m/s or rad/s
- !REAL(DbKi) :: dq(145201,6) ! Variable for storing body velocities, in m/s or rad/s
- REAL(DbKi) :: TimeInterval ! Interval between time steps, in seconds
- !INTEGER(B1Ki), ALLOCATABLE :: SaveAry(:) ! Array to store packed data structure
-
- TYPE(SS_Exc_InitInputType) :: InitInData ! Input data for initialization
- TYPE(SS_Exc_InitOutputType) :: InitOutData ! Output data from initialization
-
- TYPE(SS_Exc_ContinuousStateType) :: x ! Continuous states
- TYPE(SS_Exc_ContinuousStateType) :: x_new ! Continuous states at updated time
- TYPE(SS_Exc_DiscreteStateType) :: xd ! Discrete states
- TYPE(SS_Exc_DiscreteStateType) :: xd_new ! Discrete states at updated time
- TYPE(SS_Exc_ConstraintStateType) :: z ! Constraint states
- TYPE(SS_Exc_ConstraintStateType) :: z_residual ! Residual of the constraint state equations (Z)
- TYPE(SS_Exc_OtherStateType) :: OtherState ! Other states
-
- TYPE(SS_Exc_ParameterType) :: p ! Parameters
- TYPE(SS_Exc_InputType) :: u(1) ! System inputs
- REAL(DbKi) :: InputTimes(1) ! System input times
- TYPE(SS_Exc_OutputType) :: y ! System outputs
- TYPE(SS_Exc_MiscVarType) :: m ! misc/optimization variables
-
- TYPE(SS_Exc_ContinuousStateType) :: dxdt ! First time derivatives of the continuous states
-
-
-
- !Local Variables
- INTEGER(IntKi) :: n ! Loop counter (for time step)
- INTEGER(IntKi) :: I ! Loop counter (for time step)
- INTEGER(IntKi) :: J ! Loop counter (for time step)
- REAL(SiKi) :: ElevData
- INTEGER(IntKi) :: UnWvEl ! Input file identifier
- INTEGER(IntKi) :: Outputy ! Output file identifier
- INTEGER(IntKi) :: ErrStat, ErrStat2 ! Status of error message
- CHARACTER(1024) :: ErrMsg, ErrMsg2 ! Error message if ErrStat /= ErrID_None
- INTEGER :: Sttus ! Error in reading input file
- REAL(ReKi) :: Start ! CPU Time at start of the program
- REAL(ReKi) :: Finnish ! CPU Time at the end of the program
- REAL(ReKi) :: UsrTime
- REAL(ReKi) :: Tratio
- REAL(ReKi) :: Factor
- CHARACTER(8) :: TimePer
- INTEGER(4) :: EndTimes (8) ! An array holding the ending clock time of the simulation.
- INTEGER(4) :: StrtTime (8) ! An array holding the starting clock time of the simulation.
- REAL(ReKi) :: ClckTime
- INTEGER :: len ! Number of input arguments
- CHARACTER(1024) :: waveFile
-
- !...............................................................................................................................
- ! Routines called in initialization
- !...............................................................................................................................
-
- ErrStat = ErrID_None
- ErrMsg = ''
-
- call NWTC_Init()
-
- ! Call Time
- !call cpu_time(start)
- !call DATE_AND_TIME ( Values=StrtTime )
-
-
-
- ! Populate the InitInData data structure
-
-
- ! This file name should be the WAMIT file name without extension!
- InitInData%InputFile = 'C:\Dev\Envision\all-changes\Test_Models\5MW_Baseline\HydroData\barge'
- InitInData%WaveDir = 0.0_ReKi
- InitInData%NStepWave = 14520
- waveDT = 0.25
- allocate ( InitInData%WaveElev0(0:InitInData%NStepWave) , STAT=ErrStat2 )
- allocate ( InitInData%WaveTime (0:InitInData%NStepWave) , STAT=ErrStat2 )
-
- ! Construct the wave times array
- do i = 0,InitInData%NStepWave
- InitInData%WaveTime(i) = waveDT*i
- end do
-
- ! Need to read in the wave elevation data to pass in as initialization data
- waveFile = 'C:\Dev\Envision\all-changes\Test_Models\5MW_ITIBarge_DLL_WTurb_WavesIrr\barge.Elev'
- call GetNewUnit ( UnWvEl, ErrStat, ErrMsg )
- call OpenFInpFile ( UnWvEl, trim(waveFile), ErrStat, ErrMsg ) ! Open wave elevation file.
- if ( ErrStat /= 0 ) then
- ErrStat = ErrID_Fatal
- ErrMsg = ' Could not open wave elevation file.'
- print*, ( ErrMsg )
- end if
-
- call ReadCom ( UnWvEl, trim(waveFile), 'Header',ErrStat2, ErrMsg2 )! Reads the first entire line (Title header)
- call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Excitation_Driver')
-
- do i = 0,InitInData%NStepWave - 1
- call ReadVar( UnWvEl,trim(waveFile), InitInData%WaveElev0(i), 'InitInData%WaveElev0(i)', 'Wave elevation',ErrStat2, ErrMsg2) ! Reads in the third line, containing the number of states
- call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'SS_Excitation_Driver')
- end do
-
- close ( UnWvEl ) !Close dq input file
-
- ! Now set the last element of the Wave elevation array to match the initial elevation for wrapping
- InitInData%WaveElev0(InitInData%NStepWave) = InitInData%WaveElev0(0)
-
-
-
- ! Set the driver's request for time interval here: This should be the Rdtn DT defined in the hydrodyn input file
- TimeInterval = 0.005
-
- CALL SS_Exc_Init( InitInData, u(1), p, x, xd, z, OtherState, y, m, TimeInterval, InitOutData, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
-
-
- ! Initialize output file
- call GetNewUnit ( Outputy, ErrStat, ErrMsg )
- CALL OpenFOutFile ( Outputy, (TRIM(InitInData%InputFile)//'.out'), ErrStat, ErrMsg)
- IF ( ErrStat /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error opening output file.'
- CALL WrScr( ErrMsg )
- END IF
-
- WRITE(Outputy,*,IOSTAT=Sttus) InitOutData%WriteOutputHdr
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- ENDIF
-
- WRITE(Outputy,*,IOSTAT=Sttus) InitOutData%WriteOutputUnt
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- ENDIF
-
- !...............................................................................................................................
- ! Routines called in loose coupling -- the glue code may implement this in various ways
- !...............................................................................................................................
-
- CALL WrScr( 'Runnig SS_Excitation in Loose Coupling using a Adams-Bashforth-Moulton Method' )
-
- CALL SS_Exc_CopyDiscState( xd, xd_new, MESH_NEWCOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
-
- CALL SS_Exc_CopyContState( x, x_new, MESH_NEWCOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
- !
-
- DO n = 0,InitInData%NStepWave-1
-
- Time = n*TimeInterval
- InputTimes(1) = Time
-
- ! Get state variables at next step: constraint states (z) at step n, continuous and discrete states at step n + 1
- CALL SS_Exc_UpdateStates( Time, n, u, InputTimes, p, x_new, xd_new, z, OtherState, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
- !print*, x%x
- ! Calculate outputs at n
-
- CALL SS_Exc_CalcOutput( Time, u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- ! Update x and xd with continuous and discrete states at n + 1
- ! Note that the constraint state guess at n+1 is the value of the constraint state at n (so it doesn't need updating here)
-
- CALL SS_Exc_CopyContState( x_new, x, MESH_UPDATECOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- CALL SS_Exc_CopyDiscState( xd_new, xd, MESH_UPDATECOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- !Write Output to file
- WRITE(Outputy,'(7(e16.6))',IOSTAT=Sttus) y%WriteOutput
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- print*, ErrMsg
- ENDIF
- END DO
-
-
- CALL SS_Exc_DestroyDiscState( xd_new, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- CALL SS_Exc_DestroyContState( x_new, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- CALL SS_Exc_DestroyInitInput( InitInData, ErrStat, ErrMsg, DEALLOCATEpointers = .true. ) ! pointers were allocated in this data type, so we need to deallocate them here, too
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- !...............................................................................................................................
- ! Routine to terminate program execution
- !...............................................................................................................................
- CALL SS_Exc_End( u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN
- CALL WrScr( ErrMsg )
- END IF
-
-
- !!!! GREG: This is also to ouput values (dont need it)
- !CALL DATE_AND_TIME ( VALUES=EndTimes )
- !CALL cpu_time(finnish)
- !
- !ClckTime = 0.001*( EndTimes(8) - StrtTime(8) ) + ( EndTimes(7) - StrtTime(7) ) + 60.0*( EndTimes(6) - StrtTime(6) ) &
- ! + 3600.0*( EndTimes(5) - StrtTime(5) ) + 86400.0*( EndTimes(3) - StrtTime(3) )
- !
- !UsrTime = finnish-start
- !
- !IF ( UsrTime /= 0.0 ) THEN
- !
- !TRatio = Time / UsrTime
- !
- !IF ( UsrTime > 86400.0 ) THEN
- ! Factor = 1.0/86400.0
- ! TimePer = ' days'
- !ELSEIF ( UsrTime > 3600.0 ) THEN
- ! Factor = 1.0/3600.0
- ! TimePer = ' hours'
- !ELSEIF ( UsrTime > 60.0 ) THEN
- ! Factor = 1.0/60.0
- ! TimePer = ' minutes'
- !ELSE
- ! Factor = 1.0
- ! TimePer = ' seconds'
- !ENDIF
- !
- !CALL WrScr ( ' Total Real Time: '//TRIM( Flt2LStr( Factor*ClckTime ) )//TRIM( TimePer ) )
- !CALL WrScr ( ' Total CPU Time: '//TRIM( Flt2LStr( Factor*UsrTime ) )//TRIM( TimePer ) )
- !CALL WrScr ( ' Simulated Time: '//TRIM( Flt2LStr( Factor*REAL( Time ) ) )//TRIM( TimePer ) )
- !CALL WrScr ( ' Time Ratio (Sim/CPU): '//TRIM( Flt2LStr( TRatio ) ) )
- !
- !ENDIF
-
-
- !!Write Output to file
- ! WRITE(Outputy,'(1(e16.6))',IOSTAT=Sttus) TRatio
- ! ! Ending routines
-
- CLOSE( Outputy )
-
-
-
-END PROGRAM SS_Excitation_Driver
-
diff --git a/modules/hydrodyn/src/SS_Excitation_Types.f90 b/modules/hydrodyn/src/SS_Excitation_Types.f90
index 84657838fe..d2ba97c733 100644
--- a/modules/hydrodyn/src/SS_Excitation_Types.f90
+++ b/modules/hydrodyn/src/SS_Excitation_Types.f90
@@ -32,6 +32,7 @@
MODULE SS_Excitation_Types
!---------------------------------------------------------------------------------------------------------------------------------
USE SeaState_Interp_Types
+USE SeaSt_WaveField_Types
USE NWTC_Library
IMPLICIT NONE
! ========= SS_Exc_InitInputType =======
@@ -39,13 +40,8 @@ MODULE SS_Excitation_Types
CHARACTER(1024) :: InputFile !< Name of the input file [-]
INTEGER(IntKi) :: NBody = 0_IntKi !< Number of WAMIT bodies for this State Space model [-]
INTEGER(IntKi) :: ExctnDisp = 0_IntKi !< 0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0] [-]
- REAL(ReKi) :: WaveDir = 0.0_ReKi !< Wave direction [rad]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Number of timesteps in the WaveTime array [-]
REAL(R8Ki) , DIMENSION(:), ALLOCATABLE :: PtfmRefztRot !< The rotation about zt of the body reference frame(s) from xt/yt [radians]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveElev0 => NULL() !< Wave elevation time history at origin [m]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev1 => NULL() !< First order wave elevation (points to SeaState module data) [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Times where wave elevation is known (points to SeaState module data) [s]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to SeaState wave field [-]
END TYPE SS_Exc_InitInputType
! =======================
! ========= SS_Exc_InitOutputType =======
@@ -86,17 +82,13 @@ MODULE SS_Excitation_Types
REAL(DbKi) :: DT = 0.0_R8Ki !< Time step [s]
INTEGER(IntKi) :: NBody = 0_IntKi !< Number of WAMIT bodies for this State Space model [-]
INTEGER(IntKi) :: ExctnDisp = 0_IntKi !< 0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0] [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Number of timesteps in the WaveTime array [-]
INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: spDOF !< States per DOF [-]
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: A !< A matrix [-]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: B !< B matrix [-]
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: C !< C matrix [-]
INTEGER(IntKi) :: numStates = 0 !< Number of states [-]
REAL(DbKi) :: Tc = 0.0_R8Ki !< Time shift [s]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveElev0 => NULL() !< Wave elevation time history at origin [m]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev1 => NULL() !< First order wave elevation (points to SeaState module data) [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Times where wave elevation is known (points to SeaState module data) [s]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to SeaState wave field [-]
END TYPE SS_Exc_ParameterType
! =======================
! ========= SS_Exc_InputType =======
@@ -118,7 +110,7 @@ subroutine SS_Exc_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SS_Exc_CopyInitInput'
@@ -127,8 +119,6 @@ subroutine SS_Exc_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
DstInitInputData%InputFile = SrcInitInputData%InputFile
DstInitInputData%NBody = SrcInitInputData%NBody
DstInitInputData%ExctnDisp = SrcInitInputData%ExctnDisp
- DstInitInputData%WaveDir = SrcInitInputData%WaveDir
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
if (allocated(SrcInitInputData%PtfmRefztRot)) then
LB(1:1) = lbound(SrcInitInputData%PtfmRefztRot)
UB(1:1) = ubound(SrcInitInputData%PtfmRefztRot)
@@ -141,12 +131,7 @@ subroutine SS_Exc_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
end if
DstInitInputData%PtfmRefztRot = SrcInitInputData%PtfmRefztRot
end if
- DstInitInputData%WaveElev0 => SrcInitInputData%WaveElev0
- DstInitInputData%WaveElev1 => SrcInitInputData%WaveElev1
- DstInitInputData%WaveTime => SrcInitInputData%WaveTime
- call SeaSt_Interp_CopyParam(SrcInitInputData%SeaSt_Interp_p, DstInitInputData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
+ DstInitInputData%WaveField => SrcInitInputData%WaveField
end subroutine
subroutine SS_Exc_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
@@ -161,11 +146,7 @@ subroutine SS_Exc_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
if (allocated(InitInputData%PtfmRefztRot)) then
deallocate(InitInputData%PtfmRefztRot)
end if
- nullify(InitInputData%WaveElev0)
- nullify(InitInputData%WaveElev1)
- nullify(InitInputData%WaveTime)
- call SeaSt_Interp_DestroyParam(InitInputData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
+ nullify(InitInputData%WaveField)
end subroutine
subroutine SS_Exc_PackInitInput(Buf, Indata)
@@ -177,38 +158,18 @@ subroutine SS_Exc_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%InputFile)
call RegPack(Buf, InData%NBody)
call RegPack(Buf, InData%ExctnDisp)
- call RegPack(Buf, InData%WaveDir)
- call RegPack(Buf, InData%NStepWave)
call RegPack(Buf, allocated(InData%PtfmRefztRot))
if (allocated(InData%PtfmRefztRot)) then
call RegPackBounds(Buf, 1, lbound(InData%PtfmRefztRot), ubound(InData%PtfmRefztRot))
call RegPack(Buf, InData%PtfmRefztRot)
end if
- call RegPack(Buf, associated(InData%WaveElev0))
- if (associated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPackPointer(Buf, c_loc(InData%WaveElev0), PtrInIndex)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev0)
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
end if
end if
- call RegPack(Buf, associated(InData%WaveElev1))
- if (associated(InData%WaveElev1)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev1), ubound(InData%WaveElev1))
- call RegPackPointer(Buf, c_loc(InData%WaveElev1), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev1)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -216,7 +177,7 @@ subroutine SS_Exc_UnPackInitInput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(SS_Exc_InitInputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'SS_Exc_UnPackInitInput'
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -228,10 +189,6 @@ subroutine SS_Exc_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%ExctnDisp)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%PtfmRefztRot)) deallocate(OutData%PtfmRefztRot)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -246,79 +203,26 @@ subroutine SS_Exc_UnPackInitInput(Buf, OutData)
call RegUnpack(Buf, OutData%PtfmRefztRot)
if (RegCheckErr(Buf, RoutineName)) return
end if
- if (associated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev0, UB(1:1)-LB(1:1))
- OutData%WaveElev0(LB(1):) => OutData%WaveElev0
- else
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev0)
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev0 => null()
- end if
- if (associated(OutData%WaveElev1)) deallocate(OutData%WaveElev1)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev1, UB(1:3)-LB(1:3))
- OutData%WaveElev1(LB(1):,LB(2):,LB(3):) => OutData%WaveElev1
- else
- allocate(OutData%WaveElev1(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev1.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev1)
- call RegUnpack(Buf, OutData%WaveElev1)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev1 => null()
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpackPointer(Buf, Ptr, PtrIdx)
if (RegCheckErr(Buf, RoutineName)) return
if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
+ call c_f_pointer(Ptr, OutData%WaveField)
else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
+ allocate(OutData%WaveField,stat=stat)
if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
return
end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
end if
else
- OutData%WaveTime => null()
+ OutData%WaveField => null()
end if
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
end subroutine
subroutine SS_Exc_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg)
@@ -711,7 +615,7 @@ subroutine SS_Exc_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMs
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(2), UB(2)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SS_Exc_CopyParam'
@@ -720,7 +624,6 @@ subroutine SS_Exc_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMs
DstParamData%DT = SrcParamData%DT
DstParamData%NBody = SrcParamData%NBody
DstParamData%ExctnDisp = SrcParamData%ExctnDisp
- DstParamData%NStepWave = SrcParamData%NStepWave
if (allocated(SrcParamData%spDOF)) then
LB(1:1) = lbound(SrcParamData%spDOF)
UB(1:1) = ubound(SrcParamData%spDOF)
@@ -771,12 +674,7 @@ subroutine SS_Exc_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMs
end if
DstParamData%numStates = SrcParamData%numStates
DstParamData%Tc = SrcParamData%Tc
- DstParamData%WaveElev0 => SrcParamData%WaveElev0
- DstParamData%WaveElev1 => SrcParamData%WaveElev1
- DstParamData%WaveTime => SrcParamData%WaveTime
- call SeaSt_Interp_CopyParam(SrcParamData%SeaSt_Interp_p, DstParamData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
+ DstParamData%WaveField => SrcParamData%WaveField
end subroutine
subroutine SS_Exc_DestroyParam(ParamData, ErrStat, ErrMsg)
@@ -800,11 +698,7 @@ subroutine SS_Exc_DestroyParam(ParamData, ErrStat, ErrMsg)
if (allocated(ParamData%C)) then
deallocate(ParamData%C)
end if
- nullify(ParamData%WaveElev0)
- nullify(ParamData%WaveElev1)
- nullify(ParamData%WaveTime)
- call SeaSt_Interp_DestroyParam(ParamData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
+ nullify(ParamData%WaveField)
end subroutine
subroutine SS_Exc_PackParam(Buf, Indata)
@@ -816,7 +710,6 @@ subroutine SS_Exc_PackParam(Buf, Indata)
call RegPack(Buf, InData%DT)
call RegPack(Buf, InData%NBody)
call RegPack(Buf, InData%ExctnDisp)
- call RegPack(Buf, InData%NStepWave)
call RegPack(Buf, allocated(InData%spDOF))
if (allocated(InData%spDOF)) then
call RegPackBounds(Buf, 1, lbound(InData%spDOF), ubound(InData%spDOF))
@@ -839,31 +732,13 @@ subroutine SS_Exc_PackParam(Buf, Indata)
end if
call RegPack(Buf, InData%numStates)
call RegPack(Buf, InData%Tc)
- call RegPack(Buf, associated(InData%WaveElev0))
- if (associated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPackPointer(Buf, c_loc(InData%WaveElev0), PtrInIndex)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev0)
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
end if
end if
- call RegPack(Buf, associated(InData%WaveElev1))
- if (associated(InData%WaveElev1)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev1), ubound(InData%WaveElev1))
- call RegPackPointer(Buf, c_loc(InData%WaveElev1), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev1)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -871,7 +746,7 @@ subroutine SS_Exc_UnPackParam(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(SS_Exc_ParameterType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'SS_Exc_UnPackParam'
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(2), UB(2)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -883,8 +758,6 @@ subroutine SS_Exc_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%ExctnDisp)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%spDOF)) deallocate(OutData%spDOF)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -945,79 +818,26 @@ subroutine SS_Exc_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%Tc)
if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev0, UB(1:1)-LB(1:1))
- OutData%WaveElev0(LB(1):) => OutData%WaveElev0
- else
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev0)
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev0 => null()
- end if
- if (associated(OutData%WaveElev1)) deallocate(OutData%WaveElev1)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev1, UB(1:3)-LB(1:3))
- OutData%WaveElev1(LB(1):,LB(2):,LB(3):) => OutData%WaveElev1
- else
- allocate(OutData%WaveElev1(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev1.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev1)
- call RegUnpack(Buf, OutData%WaveElev1)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev1 => null()
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpackPointer(Buf, Ptr, PtrIdx)
if (RegCheckErr(Buf, RoutineName)) return
if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
+ call c_f_pointer(Ptr, OutData%WaveField)
else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
+ allocate(OutData%WaveField,stat=stat)
if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
return
end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
end if
else
- OutData%WaveTime => null()
+ OutData%WaveField => null()
end if
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
end subroutine
subroutine SS_Exc_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg)
diff --git a/modules/hydrodyn/src/SS_Radiation_DriverCode.f90 b/modules/hydrodyn/src/SS_Radiation_DriverCode.f90
deleted file mode 100644
index 49f8e464c8..0000000000
--- a/modules/hydrodyn/src/SS_Radiation_DriverCode.f90
+++ /dev/null
@@ -1,282 +0,0 @@
-!**********************************************************************************************************************************
-! SS_Radiation_DriverCode: This code tests the template modules
-!..................................................................................................................................
-! LICENSING
-! Copyright (C) 2012 National Renewable Energy Laboratory
-!
-! This file is part of SS_Radiation.
-!
-! SS_Radiation is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
-! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with SS_Radiation.
-! If not, see .
-!
-!**********************************************************************************************************************************
-PROGRAM SS_Radiation_Driver
-
- USE NWTC_Library
- USE SS_Radiation
- USE SS_Radiation_Types
-
- IMPLICIT NONE
-
- ! Program variables
-
- REAL(DbKi) :: Time ! Variable for storing time, in seconds
- REAL(DbKi) :: Time2(145201,1) ! Variable for storing time, in seconds
- REAL(DbKi) :: tdq(145201,7) ! Variable for storing time and body velocities, in m/s or rad/s
- REAL(DbKi) :: dq(145201,6) ! Variable for storing body velocities, in m/s or rad/s
- REAL(DbKi) :: TimeInterval ! Interval between time steps, in seconds
- INTEGER(B1Ki), ALLOCATABLE :: SaveAry(:) ! Array to store packed data structure
-
- TYPE(SS_Rad_InitInputType) :: InitInData ! Input data for initialization
- TYPE(SS_Rad_InitOutputType) :: InitOutData ! Output data from initialization
-
- TYPE(SS_Rad_ContinuousStateType) :: x ! Continuous states
- TYPE(SS_Rad_ContinuousStateType) :: x_new ! Continuous states at updated time
- TYPE(SS_Rad_DiscreteStateType) :: xd ! Discrete states
- TYPE(SS_Rad_DiscreteStateType) :: xd_new ! Discrete states at updated time
- TYPE(SS_Rad_ConstraintStateType) :: z ! Constraint states
- TYPE(SS_Rad_ConstraintStateType) :: z_residual ! Residual of the constraint state equations (Z)
- TYPE(SS_Rad_OtherStateType) :: OtherState ! Other states
-
- TYPE(SS_Rad_ParameterType) :: p ! Parameters
- TYPE(SS_Rad_InputType) :: u ! System inputs
- TYPE(SS_Rad_OutputType) :: y ! System outputs
- TYPE(SS_Rad_MiscVarType) :: m ! misc/optimization variables
-
- TYPE(SS_Rad_ContinuousStateType) :: dxdt ! First time derivatives of the continuous states
-
-
-
- !Local Variables
- INTEGER(IntKi) :: n ! Loop counter (for time step)
- INTEGER(IntKi) :: I ! Loop counter (for time step)
- INTEGER(IntKi) :: J ! Loop counter (for time step)
- INTEGER(IntKi) :: Inputdq ! Input file identifier
- INTEGER(IntKi) :: Outputy ! Output file identifier
- INTEGER(IntKi) :: ErrStat ! Status of error message
- CHARACTER(1024) :: ErrMsg ! Error message if ErrStat /= ErrID_None
- INTEGER :: Sttus ! Error in reading input file
- REAL(ReKi) :: Start ! CPU Time at start of the program
- REAL(ReKi) :: Finnish ! CPU Time at the end of the program
- REAL(ReKi) :: UsrTime
- REAL(ReKi) :: Tratio
- REAL(ReKi) :: Factor
- CHARACTER(8) :: TimePer
- INTEGER(4) :: EndTimes (8) ! An array holding the ending clock time of the simulation.
- INTEGER(4) :: StrtTime (8) ! An array holding the starting clock time of the simulation.
- REAL(ReKi) :: ClckTime
- INTEGER :: len ! Number of input arguments
-
- !...............................................................................................................................
- ! Routines called in initialization
- !...............................................................................................................................
-
- ! Call Time
- CALL cpu_time(start)
- CALL DATE_AND_TIME ( Values=StrtTime )
-
- ! Populate the InitInData data structure here:
-
- InitInData%InputFile = 'C:\Users\tduarte\Documents\SS_Module\Comparisons\FAST_output_freq\spar_IMP_097'
- !!! GREG !!!: This file name should be the WAMIT file name without extension!
-
-
- InitInData%Dofs = 1
- !!! GREG: This is a vector of [1x6] containing 0 and 1 if each of the 6 dofs is enabled or not (as we discussed today in the meeting)
-
-
- ! Set the driver's request for time interval here:
- TimeInterval = 0.025 ! Glue code's request for delta time (likely based on information from other modules)
- !!! GREG: This should be the Rdtn DT defined in the platform input file@
-
- CALL SS_Rad_Init( InitInData, u, p, x, xd, z, OtherState, y, m, TimeInterval, InitOutData, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- !!! GREG: This version reads in the desired file containing the platform velocities. You don't need this in your case.
- CALL CheckArgs( InitInData%InputFile )
-
- CALL Get_Arg_Num (len )
-
- ! Read the time dependent input vector dq
- CALL OpenFInpFile ( Inputdq, (TRIM(InitInData%InputFile)//'.txt'), ErrStat ) ! Open motion file.
- IF ( ErrStat /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error allocating memory for the dq array.'
- print*, ( ErrMsg )
- END IF
-
-
-
- DO I = 1,145201 !Read dq Matrix
- READ (Inputdq,*,IOSTAT=Sttus) (tdq (I,J), J=1,7)
- ENDDO
-
- CLOSE ( Inputdq ) !Close dq input file
-
- Time2(:,1) = tdq(:,1)
- dq = tdq(:,2:7)
-
- !!!GREG: here the output file is opened, you should not need this
- !Initialize output file
- CALL OpenFOutFile ( Outputy, (TRIM(InitInData%InputFile)//'.out'), ErrStat)
- IF ( ErrStat /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error opening output file.'
- CALL WrScr( ErrMsg )
- END IF
-
- WRITE(Outputy,*,IOSTAT=Sttus) InitOutData%WriteOutputHdr
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- ENDIF
-
- WRITE(Outputy,*,IOSTAT=Sttus) InitOutData%WriteOutputUnt
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- ENDIF
-
- !...............................................................................................................................
- ! Routines called in loose coupling -- the glue code may implement this in various ways
- !...............................................................................................................................
-
- CALL WrScr( 'Runnig SS_Radiation in Loose Coupling using a Adams-Bashforth-Moulton Method' )
-
- CALL SS_Rad_CopyDiscState( xd, xd_new, MESH_NEWCOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
-
- CALL SS_Rad_CopyContState( x, x_new, MESH_NEWCOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
- !
-!CALL cpu_time(T1)
- DO n = 0,145200
-
- Time = n*TimeInterval
-
- ! Modify u (likely from the outputs of another module or a set of test conditions) here:
-
- u%dq(1,1) = dq (n+1,1)
- u%dq(2,1) = dq (n+1,2)
- u%dq(3,1) = dq (n+1,3)
- u%dq(4,1) = dq (n+1,4)
- u%dq(5,1) = dq (n+1,5)
- u%dq(6,1) = dq (n+1,6)
-
- ! Get state variables at next step: constraint states (z) at step n, continuous and discrete states at step n + 1
-
- CALL SS_Rad_UpdateStates( Time, u, p, x_new, xd_new, z, OtherState, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
- !print*, x%x
- ! Calculate outputs at n
-
- CALL SS_Rad_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- ! Update x and xd with continuous and discrete states at n + 1
- ! Note that the constraint state guess at n+1 is the value of the constraint state at n (so it doesn't need updating here)
-
- CALL SS_Rad_CopyContState( x_new, x, MESH_UPDATECOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- CALL SS_Rad_CopyDiscState( xd_new, xd, MESH_UPDATECOPY, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- !Write Output to file
- WRITE(Outputy,'(7(e16.6))',IOSTAT=Sttus) y%WriteOutput
- IF ( Sttus /= 0 ) THEN
- ErrStat = ErrID_Fatal
- ErrMsg = ' Error writing output file.'
- CALL WrScr( ErrMsg )
- print*, ErrMsg
- ENDIF
- END DO
-
-
- CALL SS_Rad_DestroyDiscState( xd_new, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
- CALL SS_Rad_DestroyContState( x_new, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary
- CALL WrScr( ErrMsg )
- END IF
-
-
- !...............................................................................................................................
- ! Routine to terminate program execution
- !...............................................................................................................................
- CALL SS_Rad_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
- IF ( ErrStat /= ErrID_None ) THEN
- CALL WrScr( ErrMsg )
- END IF
-
-
- !!! GREG: This is also to ouput values (dont need it)
- CALL DATE_AND_TIME ( VALUES=EndTimes )
- CALL cpu_time(finnish)
-
- ClckTime = 0.001*( EndTimes(8) - StrtTime(8) ) + ( EndTimes(7) - StrtTime(7) ) + 60.0*( EndTimes(6) - StrtTime(6) ) &
- + 3600.0*( EndTimes(5) - StrtTime(5) ) + 86400.0*( EndTimes(3) - StrtTime(3) )
-
- UsrTime = finnish-start
-
- IF ( UsrTime /= 0.0 ) THEN
-
- TRatio = Time / UsrTime
-
- IF ( UsrTime > 86400.0 ) THEN
- Factor = 1.0/86400.0
- TimePer = ' days'
- ELSEIF ( UsrTime > 3600.0 ) THEN
- Factor = 1.0/3600.0
- TimePer = ' hours'
- ELSEIF ( UsrTime > 60.0 ) THEN
- Factor = 1.0/60.0
- TimePer = ' minutes'
- ELSE
- Factor = 1.0
- TimePer = ' seconds'
- ENDIF
-
- CALL WrScr ( ' Total Real Time: '//TRIM( Flt2LStr( Factor*ClckTime ) )//TRIM( TimePer ) )
- CALL WrScr ( ' Total CPU Time: '//TRIM( Flt2LStr( Factor*UsrTime ) )//TRIM( TimePer ) )
- CALL WrScr ( ' Simulated Time: '//TRIM( Flt2LStr( Factor*REAL( Time ) ) )//TRIM( TimePer ) )
- CALL WrScr ( ' Time Ratio (Sim/CPU): '//TRIM( Flt2LStr( TRatio ) ) )
-
- ENDIF
-
-
- !Write Output to file
- WRITE(Outputy,'(1(e16.6))',IOSTAT=Sttus) TRatio
- ! Ending routines
- CLOSE( Outputy )
-
-
-
-END PROGRAM SS_Radiation_Driver
-
diff --git a/modules/hydrodyn/src/WAMIT.f90 b/modules/hydrodyn/src/WAMIT.f90
index 5a636df0af..b740b6cd35 100644
--- a/modules/hydrodyn/src/WAMIT.f90
+++ b/modules/hydrodyn/src/WAMIT.f90
@@ -217,14 +217,13 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
ErrMsg = ""
! Copy Output Init data from Waves Module Init call
-
- p%NStepWave = InitInp%NStepWave
p%ExctnMod = InitInp%ExctnMod
p%ExctnDisp = InitInp%ExctnDisp
p%ExctnCutOff = InitInp%ExctnCutOff
p%NBodyMod = InitInp%NBodyMod
p%NBody = InitInp%NBody ! In the context of this WAMIT object NBody is 1 if NBodyMod > 1 [there are NBody different WAMIT objects in this case]
- p%seast_interp_p = InitInp%seast_interp_p
+ p%WaveField => InitInp%WaveField
+
! 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
CALL SetErrStat( ErrID_Fatal, "DEVELOPER ERROR: If NBodyMod = 2 or 3, then NBody for the a WAMIT object must be equal to 1", ErrStat, ErrMsg, RoutineName)
@@ -244,9 +243,9 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
do iBody = 1, p%NBody
p%F_HS_Moment_Offset(1,iBody) = 0.0_ReKi
p%F_HS_Moment_Offset(2,iBody) = 0.0_ReKi
- p%F_HS_Moment_Offset(3,iBody) = InitInp%RhoXg*InitInp%PtfmVol0(iBody) ! except for the hydrostatic buoyancy force from Archimede's Principle when the support platform is in its undisplaced position
- p%F_HS_Moment_Offset(4,iBody) = InitInp%RhoXg*InitInp%PtfmVol0(iBody)*( InitInp%PtfmCOByt(iBody) - InitInp%PtfmRefyt(iBody) ) ! and the moment about X due to the COB being offset from the local WAMIT reference point
- p%F_HS_Moment_Offset(5,iBody) = -InitInp%RhoXg*InitInp%PtfmVol0(iBody)*( InitInp%PtfmCOBxt(iBody) - InitInp%PtfmRefxt(iBody) ) ! and the moment about Y due to the COB being offset from the localWAMIT reference point
+ p%F_HS_Moment_Offset(3,iBody) = p%WaveField%RhoXg*InitInp%PtfmVol0(iBody) ! except for the hydrostatic buoyancy force from Archimede's Principle when the support platform is in its undisplaced position
+ p%F_HS_Moment_Offset(4,iBody) = p%WaveField%RhoXg*InitInp%PtfmVol0(iBody)*( InitInp%PtfmCOByt(iBody) - InitInp%PtfmRefyt(iBody) ) ! and the moment about X due to the COB being offset from the local WAMIT reference point
+ p%F_HS_Moment_Offset(5,iBody) = -p%WaveField%RhoXg*InitInp%PtfmVol0(iBody)*( InitInp%PtfmCOBxt(iBody) - InitInp%PtfmRefxt(iBody) ) ! and the moment about Y due to the COB being offset from the localWAMIT reference point
p%F_HS_Moment_Offset(6,iBody) = 0.0_ReKi
end do
@@ -260,16 +259,16 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! element-by-element multiplication, instead of matrix-by-matrix
! multiplication:
- SttcDim(1,1) = InitInp%RhoXg *InitInp%WAMITULEN**2 ! Force-translation
- SttcDim(1,4) = InitInp%RhoXg *InitInp%WAMITULEN**3 ! Force-rotation/Moment-translation - Hydrostatic restoring
- SttcDim(4,4) = InitInp%RhoXg *InitInp%WAMITULEN**4 ! Moment-rotation
+ SttcDim(1,1) = p%WaveField%RhoXg *InitInp%WAMITULEN**2 ! Force-translation
+ SttcDim(1,4) = p%WaveField%RhoXg *InitInp%WAMITULEN**3 ! Force-rotation/Moment-translation - Hydrostatic restoring
+ SttcDim(4,4) = p%WaveField%RhoXg *InitInp%WAMITULEN**4 ! Moment-rotation
- RdtnDim(1,1) = InitInp%WtrDens*InitInp%WAMITULEN**3 ! Force-translation
- RdtnDim(1,4) = InitInp%WtrDens*InitInp%WAMITULEN**4 ! Force-rotation/Moment-translation - Hydrodynamic added mass and damping
- RdtnDim(4,4) = InitInp%WtrDens*InitInp%WAMITULEN**5 ! Moment-rotation
+ RdtnDim(1,1) = p%WaveField%WtrDens*InitInp%WAMITULEN**3 ! Force-translation
+ RdtnDim(1,4) = p%WaveField%WtrDens*InitInp%WAMITULEN**4 ! Force-rotation/Moment-translation - Hydrodynamic added mass and damping
+ RdtnDim(4,4) = p%WaveField%WtrDens*InitInp%WAMITULEN**5 ! Moment-rotation
- DffrctDim(1) = InitInp%RhoXg *InitInp%WAMITULEN**2 ! Force-translation - Hydrodynamic wave excitation force
- DffrctDim(4) = InitInp%RhoXg *InitInp%WAMITULEN**3 ! Moment-rotation
+ DffrctDim(1) = p%WaveField%RhoXg *InitInp%WAMITULEN**2 ! Force-translation - Hydrodynamic wave excitation force
+ DffrctDim(4) = p%WaveField%RhoXg *InitInp%WAMITULEN**3 ! Moment-rotation
DO I = 1,3 ! Loop through all force-translation elements (rows)
@@ -902,13 +901,14 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
else
! Initialize the variables associated with the incident wave:
- SELECT CASE ( InitInp%WaveMod ) ! Which incident wave kinematics model are we using?
- CASE ( 0 ) ! No waves, NOTE: for this case we are forcing ExctnDisp = 0, so only p%WaveExctn needs to be allocated, not p%WaveExctnGrid
+ SELECT CASE ( p%WaveField%WaveMod ) ! Which incident wave kinematics model are we using?
+
+ CASE ( WaveMod_None ) ! No waves, NOTE: for this case we are forcing ExctnDisp = 0, so only p%WaveExctn needs to be allocated, not p%WaveExctnGrid
if ( p%ExctnMod == 1 ) then
! Initialize everything to zero:
- ALLOCATE ( p%WaveExctn (0:InitInp%NStepWave,6*p%NBody) , STAT=ErrStat2 )
+ ALLOCATE ( p%WaveExctn (0:p%WaveField%NStepWave,6*p%NBody) , STAT=ErrStat2 )
IF ( ErrStat2 /= 0 ) THEN
CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the WaveExctn array.', ErrStat, ErrMsg, RoutineName)
CALL Cleanup()
@@ -920,25 +920,12 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
else if ( p%ExctnMod == 2 ) then
Interval_Sub = InitInp%Conv_Rdtn%RdtnDT
SS_Exctn_InitInp%InputFile = InitInp%WAMITFile
- SS_Exctn_InitInp%WaveDir = InitInp%WaveDir
- SS_Exctn_InitInp%NStepWave = p%NStepWave
SS_Exctn_InitInp%NBody = InitInp%NBody
SS_Exctn_InitInp%PtfmRefztRot = InitInp%PtfmRefztRot
SS_Exctn_InitInp%ExctnDisp = InitInp%ExctnDisp
- ! No other modules need this WaveElev0 array so we will simply move the allocation over to the SS_Exctn module
- IF (ASSOCIATED(InitInp%WaveElev0)) SS_Exctn_InitInp%WaveElev0 => InitInp%WaveElev0
- IF (ASSOCIATED(InitInp%WaveElev1)) SS_Exctn_InitInp%WaveElev1 => InitInp%WaveElev1
!TODO: Verify what happens within SS_Exctn when we have no waves.
-
- ! We need the WaveTime array to stay intact for use in other modules, so we will make a copy instead of moving the allocation
- !ALLOCATE ( SS_Exctn_InitInp%WaveTime (0:InitInp%NStepWave) , STAT=ErrStat2 )
- !IF ( ErrStat2 /= 0 ) THEN
- ! CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the SS_Exctn_InitInp%WaveTime array.', ErrStat, ErrMsg, RoutineName)
- ! CALL Cleanup()
- ! RETURN
- !END IF
- SS_Exctn_InitInp%WaveTime => InitInp%WaveTime
+ SS_Exctn_InitInp%WaveField => p%WaveField
call SS_Exc_Init(SS_Exctn_InitInp, m%SS_Exctn_u, p%SS_Exctn, x%SS_Exctn, xd%SS_Exctn, z%SS_Exctn, OtherState%SS_Exctn, &
m%SS_Exctn_y, m%SS_Exctn, Interval_Sub, SS_Exctn_InitOut, ErrStat2, ErrMsg2)
@@ -949,7 +936,14 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
return
end if
end if
- CASE ( 1, 2, 3, 4, 5, 7, 10 ) ! Plane progressive (regular) wave, JONSWAP/Pierson-Moskowitz spectrum (irregular) wave, white-noise wave, or user-defined spectrum (irregular) wave.
+
+ CASE ( WaveMod_ExtFull ) ! User wave data.
+
+ CALL SetErrStat( ErrID_Fatal, 'User input wave data not applicable for floating platforms.', ErrStat, ErrMsg, RoutineName)
+ CALL Cleanup()
+ RETURN
+
+ CASE DEFAULT ! remaining cases: ( 1, 2, 3, 4, 5, 7, 10 ) ! Plane progressive (regular) wave, JONSWAP/Pierson-Moskowitz spectrum (irregular) wave, white-noise wave, or user-defined spectrum (irregular) wave.
if ( p%ExctnMod == 1 ) then
@@ -962,7 +956,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! NOTE: we may end up inadvertantly aborting if the wave direction crosses
! the -Pi / Pi boundary (-180/180 degrees).
- IF ( ( InitInp%WaveDirMin < HdroWvDir(1) ) .OR. ( InitInp%WaveDirMax > HdroWvDir(NInpWvDir) ) ) THEN
+ IF ( ( p%WaveField%WaveDirMin < HdroWvDir(1) ) .OR. ( p%WaveField%WaveDirMax > HdroWvDir(NInpWvDir) ) ) THEN
ErrMsg2 = 'All Wave directions must be within the wave heading angle range available in "' &
//TRIM(InitInp%WAMITFile)//'.3" (inclusive).'
CALL SetErrStat( ErrID_Fatal, ErrMsg2, ErrStat, ErrMsg, RoutineName)
@@ -974,7 +968,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! ALLOCATE the arrays:
- ALLOCATE ( WaveExctnC(0:InitInp%NStepWave2 ,6*p%NBody) , STAT=ErrStat2 )
+ ALLOCATE ( WaveExctnC(0:p%WaveField%NStepWave2 ,6*p%NBody) , STAT=ErrStat2 )
IF ( ErrStat2 /= 0 ) THEN
CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the WaveExctnC array.', ErrStat, ErrMsg, RoutineName)
CALL Cleanup()
@@ -982,20 +976,20 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
if (p%ExctnDisp > 0 ) then
- ALLOCATE ( WaveExctnCGrid(0:InitInp%NStepWave2 ,p%SeaSt_Interp_p%n(2)*p%SeaSt_Interp_p%n(3),6*p%NBody) , STAT=ErrStat2 )
+ ALLOCATE ( WaveExctnCGrid(0:p%WaveField%NStepWave2 ,p%WaveField%SeaSt_Interp_p%n(2)*p%WaveField%SeaSt_Interp_p%n(3),6*p%NBody) , STAT=ErrStat2 )
IF ( ErrStat2 /= 0 ) THEN
CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the WaveExctnC array.', ErrStat, ErrMsg, RoutineName)
CALL Cleanup()
RETURN
END IF
- ALLOCATE ( p%WaveExctnGrid (0:InitInp%NStepWave,p%SeaSt_Interp_p%n(2),p%SeaSt_Interp_p%n(3), 6*p%NBody) , STAT=ErrStat2 )
+ ALLOCATE ( p%WaveExctnGrid (0:p%WaveField%NStepWave,p%WaveField%SeaSt_Interp_p%n(2),p%WaveField%SeaSt_Interp_p%n(3), 6*p%NBody) , STAT=ErrStat2 )
IF ( ErrStat2 /= 0 ) THEN
CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the WaveExctn array.', ErrStat, ErrMsg, RoutineName)
CALL Cleanup()
RETURN
END IF
else
- ALLOCATE ( p%WaveExctn (0:InitInp%NStepWave,6*p%NBody) , STAT=ErrStat2 )
+ ALLOCATE ( p%WaveExctn (0:p%WaveField%NStepWave,6*p%NBody) , STAT=ErrStat2 )
IF ( ErrStat2 /= 0 ) THEN
CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the WaveExctn array.', ErrStat, ErrMsg, RoutineName)
CALL Cleanup()
@@ -1035,7 +1029,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
do J = 1, NInpWvDir
do I = 1, NInpFreq
! Fxy = exp(-j * k(w) * ( X*cos(Beta(w)) + Y*sin(Beta(w)) )
- WaveNmbr = WaveNumber ( HdroFreq(I), InitInp%Gravity, InitInp%WtrDpth )
+ WaveNmbr = WaveNumber ( HdroFreq(I), InitInp%Gravity, p%WaveField%EffWtrDpth )
tmpAngle = WaveNmbr * ( InitInp%PtfmRefxt(1)*cos(HdroWvDir(J)*D2R) + InitInp%PtfmRefyt(1)*sin(HdroWvDir(J)*D2R) )
TmpRe = cos(tmpAngle)
TmpIm = -sin(tmpAngle)
@@ -1074,11 +1068,11 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! Compute the positive-frequency components (including zero) of the discrete
! Fourier transform of the wave excitation force:
- DO I = 0,InitInp%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
+ DO I = 0,p%WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
! Compute the frequency of this component:
- Omega = I*InitInp%WaveDOmega
+ Omega = I*p%WaveField%WaveDOmega
! Compute the discrete Fourier transform of the instantaneous value of the
@@ -1086,14 +1080,14 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
DO J = 1,6*p%NBody ! Loop through all wave excitation forces and moments
TmpCoord(1) = Omega
- TmpCoord(2) = InitInp%WaveDirArr(I)
+ TmpCoord(2) = p%WaveField%WaveDirArr(I)
CALL WAMIT_Interp2D_Cplx( TmpCoord, HdroExctn(:,:,J), HdroFreq, HdroWvDir, LastInd2, WaveExctnC(I,J), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL Cleanup()
RETURN
END IF
- WaveExctnC(I,J) = WaveExctnC(I,J) * CMPLX(InitInp%WaveElevC0(1,I), InitInp%WaveElevC0(2,I))
+ WaveExctnC(I,J) = WaveExctnC(I,J) * CMPLX(p%WaveField%WaveElevC0(1,I), p%WaveField%WaveElevC0(2,I))
END DO ! J - All wave excitation forces and moments
@@ -1102,7 +1096,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! Compute the inverse discrete Fourier transform to find the time-domain
! representation of the wave excitation force:
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .TRUE., ErrStat2 )
+ CALL InitFFT ( p%WaveField%NStepWave, FFT_Data, .TRUE., ErrStat2 )
CALL SetErrStat( ErrStat2, 'Error in call to InitFFT.', ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev) THEN
CALL Cleanup()
@@ -1110,7 +1104,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
DO J = 1,6*p%NBody ! Loop through all wave excitation forces and moments
- CALL ApplyFFT_cx ( p%WaveExctn(0:InitInp%NStepWave-1,J), WaveExctnC(:,J), FFT_Data, ErrStat2 )
+ CALL ApplyFFT_cx ( p%WaveExctn(0:p%WaveField%NStepWave-1,J), WaveExctnC(:,J), FFT_Data, ErrStat2 )
CALL SetErrStat( ErrStat2, ' An error occured while applying an FFT to WaveExctnC.', ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev) THEN
CALL Cleanup()
@@ -1118,7 +1112,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
! Append first datpoint as the last as aid for repeated wave data
- p%WaveExctn(InitInp%NStepWave,J) = p%WaveExctn(0,J)
+ p%WaveExctn(p%WaveField%NStepWave,J) = p%WaveExctn(0,J)
END DO ! J - All wave excitation forces and moments
CALL ExitFFT(FFT_Data, ErrStat2)
@@ -1129,26 +1123,26 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
else
- DO I = 0,InitInp%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
+ DO I = 0,p%WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
! Compute the frequency of this component:
- Omega = I*InitInp%WaveDOmega
+ Omega = I*p%WaveField%WaveDOmega
! Compute the discrete Fourier transform of the instantaneous value of the
! total excitation force on the support platfrom from incident waves:
DO J = 1,6*p%NBody ! Loop through all wave excitation forces and moments
TmpCoord(1) = Omega
- TmpCoord(2) = InitInp%WaveDirArr(I)
+ TmpCoord(2) = p%WaveField%WaveDirArr(I)
CALL WAMIT_Interp2D_Cplx( TmpCoord, HdroExctn(:,:,J), HdroFreq, HdroWvDir, LastInd2, WaveExctnC(I,J), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL Cleanup()
RETURN
END IF
- do iGrid = 1, p%SeaSt_Interp_p%n(2)*p%SeaSt_Interp_p%n(3)
- WaveExctnCGrid(I,iGrid,J) = WaveExctnC(I,J) * CMPLX(InitInp%WaveElevC(1,I,iGrid), InitInp%WaveElevC(2,I,iGrid))
+ do iGrid = 1, p%WaveField%SeaSt_Interp_p%n(2)*p%WaveField%SeaSt_Interp_p%n(3)
+ WaveExctnCGrid(I,iGrid,J) = WaveExctnC(I,J) * CMPLX(p%WaveField%WaveElevC(1,I,iGrid), p%WaveField%WaveElevC(2,I,iGrid))
end do
END DO ! J - All wave excitation forces and moments
END DO ! I - The positive frequency components (including zero) of the discrete Fourier transform
@@ -1156,7 +1150,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! Compute the inverse discrete Fourier transform to find the time-domain
! representation of the wave excitation force:
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .TRUE., ErrStat2 )
+ CALL InitFFT ( p%WaveField%NStepWave, FFT_Data, .TRUE., ErrStat2 )
CALL SetErrStat( ErrStat2, 'Error in call to InitFFT.', ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev) THEN
CALL Cleanup()
@@ -1164,17 +1158,17 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
DO J = 1,6*p%NBody ! Loop through all wave excitation forces and moments
- do iGrid = 1, p%SeaSt_Interp_p%n(2)*p%SeaSt_Interp_p%n(3)
- iX = mod(iGrid-1, p%SeaSt_Interp_p%n(2)) + 1 ! 1st n index is time
- iY = (iGrid-1) / p%SeaSt_Interp_p%n(2) + 1
- CALL ApplyFFT_cx ( p%WaveExctnGrid(0:InitInp%NStepWave-1,iX,iY,J), WaveExctnCGrid(:,iGrid,J), FFT_Data, ErrStat2 )
+ do iGrid = 1, p%WaveField%SeaSt_Interp_p%n(2)*p%WaveField%SeaSt_Interp_p%n(3)
+ iX = mod(iGrid-1, p%WaveField%SeaSt_Interp_p%n(2)) + 1 ! 1st n index is time
+ iY = (iGrid-1) / p%WaveField%SeaSt_Interp_p%n(2) + 1
+ CALL ApplyFFT_cx ( p%WaveExctnGrid(0:p%WaveField%NStepWave-1,iX,iY,J), WaveExctnCGrid(:,iGrid,J), FFT_Data, ErrStat2 )
CALL SetErrStat( ErrStat2, ' An error occured while applying an FFT to WaveExctnC.', ErrStat, ErrMsg, RoutineName)
IF ( ErrStat >= AbortErrLev) THEN
CALL Cleanup()
RETURN
END IF
! Append first datpoint as the last as aid for repeated wave data
- p%WaveExctnGrid(InitInp%NStepWave,iX,iY,J) = p%WaveExctnGrid(0,iX,iY,J)
+ p%WaveExctnGrid(p%WaveField%NStepWave,iX,iY,J) = p%WaveExctnGrid(0,iX,iY,J)
end do
END DO ! J - All wave excitation forces and moments
@@ -1189,56 +1183,21 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
end if
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ! Dump the HdroFreq variable to a file for debugging
- ! Open and write header info to the HydroDyn Output File
- !CALL OpenFOutFile ( 66, 'C:\Dev\NREL_SVN\HydroDyn\branches\HydroDyn_Modularization\Samples\NRELOffshrBsline5MW_OC3Hywind\HdroFreq_HD.txt', ErrStat ) ! Open motion file.
- !DO K = 1, NInpFreq
- ! WRITE ( 66, '(2(e20.9))', IOSTAT = ErrStat) REAL(K), HdroFreq(K)
- !END DO
- !CLOSE ( 66 )
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ! Dump the WaveElevCO variable to a file for debugging
- ! Open and write header info to the HydroDyn Output File
- !CALL OpenFOutFile ( 66, 'C:\Dev\NREL_SVN\HydroDyn\branches\HydroDyn_Modularization\Samples\NRELOffshrBsline5MW_OC3Hywind\WaveElevC0_HD.txt', ErrStat ) ! Open motion file.
- !DO K = 0, InitInp%NStepWave2
- ! WRITE ( 66, '(2(e20.9))', IOSTAT = ErrStat) REAL(K), REAL(InitInp%WaveElevC0(K))
- !END DO
- !CLOSE ( 66 )
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ! Dump the WaveExctnC variable to a file for debugging
- ! Open and write header info to the HydroDyn Output File
- !CALL OpenFOutFile ( 66, 'C:\Dev\NREL_SVN\HydroDyn\branches\HydroDyn_Modularization\Samples\NRELOffshrBsline5MW_OC3Hywind\WaveExctnC_HD.txt', ErrStat ) ! Open motion file.
- !DO K = 0, InitInp%NStepWave2
- ! WRITE ( 66, '(7(e20.9))', IOSTAT = ErrStat) REAL(K), REAL(WaveExctnC(K,:))
- !END DO
- !CLOSE ( 66 )
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
else if ( p%ExctnMod == 2 ) then
Interval_Sub = InitInp%Conv_Rdtn%RdtnDT
SS_Exctn_InitInp%InputFile = InitInp%WAMITFile
- SS_Exctn_InitInp%WaveDir = InitInp%WaveDir
- SS_Exctn_InitInp%NStepWave = p%NStepWave
SS_Exctn_InitInp%NBody = InitInp%NBody
SS_Exctn_InitInp%PtfmRefztRot = InitInp%PtfmRefztRot
- SS_Exctn_InitInp%SeaSt_Interp_p = InitInp%SeaSt_Interp_p
SS_Exctn_InitInp%ExctnDisp = InitInp%ExctnDisp
+
+ SS_Exctn_InitInp%WaveField => p%WaveField
+
! We have been passed a pointer to WaveElev0 for use by the State Space excitation module.
! If the special case shown below is not used, then the state space model simply uses WaveElev0, as is.
! however, if we are using the special case, then WaveElev0 will be modified. This is okay, because no one else
! is using WaveElev0 data
if (p%ExctnDisp == 0 ) then
- if (associated(InitInp%WaveElev0)) then
-
- ! No other modules need this WaveElev0 array so we will simply move the allocation over to the SS_Exctn module
- ! call MOVE_ALLOC(InitInp%WaveElev0, SS_Exctn_InitInp%WaveElev0)
- SS_Exctn_InitInp%WaveElev0 => InitInp%WaveElev0
+ if (allocated(SS_Exctn_InitInp%WaveField%WaveElev0)) then !NOTE THIS OVERWRITES THE WAVEFIELD WaveElev0 data
! Handle special case when NBodyMod=2 and (PtfmRefxt /= 0 or PtfmRefyt /= 0) : Need to phase shift the wave elevation data for the offset body
if ( p%NBodyMod==2 .and. (InitInp%PtfmRefxt(1) /= 0 .or. InitInp%PtfmRefyt(1) /= 0) ) then
@@ -1248,19 +1207,19 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! Now apply the phase shift in the frequency space
do J = 1, NInpWvDir
- do I = 0,InitInp%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
+ do I = 0,p%WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
! Compute the frequency of this component:
- Omega = I*InitInp%WaveDOmega
+ Omega = I*p%WaveField%WaveDOmega
! Fxy = exp(-j * k(w) * ( X*cos(Beta(w)) + Y*sin(Beta(w)) )
- WaveNmbr = WaveNumber ( Omega, InitInp%Gravity, InitInp%WtrDpth )
+ WaveNmbr = WaveNumber ( Omega, InitInp%Gravity, p%WaveField%EffWtrDpth )
tmpAngle = WaveNmbr * ( InitInp%PtfmRefxt(1)*cos(HdroWvDir(J)*D2R) + InitInp%PtfmRefyt(1)*sin(HdroWvDir(J)*D2R) )
TmpRe = cos(tmpAngle)
TmpIm = -sin(tmpAngle)
Fxy = CMPLX( TmpRe, TmpIm )
- tmpComplexArr(I) = Fxy*CMPLX(InitInp%WaveElevC0(1,I), InitInp%WaveElevC0(2,I))
+ tmpComplexArr(I) = Fxy*CMPLX(p%WaveField%WaveElevC0(1,I), p%WaveField%WaveElevC0(2,I))
end do
@@ -1269,7 +1228,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
! Compute the inverse discrete Fourier transforms to find the time-domain
! representations of the wave kinematics without stretching:
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .TRUE., ErrStat2 )
+ CALL InitFFT ( p%WaveField%NStepWave, FFT_Data, .TRUE., ErrStat2 )
CALL SetErrStat(ErrStat2,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -1277,7 +1236,8 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
END IF
! We'll need the following for wave stretching once we implement it.
- CALL ApplyFFT_cx ( SS_Exctn_InitInp%WaveElev0(0:InitInp%NStepWave-1), tmpComplexArr(: ), FFT_Data, ErrStat2 )
+ ! NOTE THIS IS OVERWRITING THE WAVEFIELD WaveElev0 PARAMETER DATA
+ CALL ApplyFFT_cx ( SS_Exctn_InitInp%WaveField%WaveElev0(0:p%WaveField%NStepWave-1), tmpComplexArr(: ), FFT_Data, ErrStat2 )
CALL SetErrStat(ErrStat2,'Error occured while applying the FFT to WaveElev0.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -1294,20 +1254,9 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
end if
else
!TODO: Error message because we need WaveElev0 for ExctnDisp=0
+ call SetErrStat( ErrID_Severe, 'SS Excitation does not contain WaveElev0 data.', ErrStat, ErrMsg, RoutineName )
end if
- else
- SS_Exctn_InitInp%WaveElev1 => InitInp%WaveElev1
end if
-
- ! We need the WaveTime array to stay intact for use in other modules, so we will make a copy instead of moving the allocation
- !ALLOCATE ( SS_Exctn_InitInp%WaveTime (0:InitInp%NStepWave) , STAT=ErrStat2 )
- !IF ( ErrStat2 /= 0 ) THEN
- ! CALL SetErrStat( ErrID_Fatal, 'Error allocating memory for the SS_Exctn_InitInp%WaveTime array.', ErrStat, ErrMsg, RoutineName)
- ! CALL Cleanup()
- ! RETURN
- !END IF
- SS_Exctn_InitInp%WaveTime => InitInp%WaveTime
-
call SS_Exc_Init(SS_Exctn_InitInp, m%SS_Exctn_u, p%SS_Exctn, x%SS_Exctn, xd%SS_Exctn, z%SS_Exctn, OtherState%SS_Exctn, &
@@ -1331,12 +1280,6 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
xd%BdyPosFilt = 0.0_ReKi
END IF
- CASE ( 6 ) ! User wave data.
-
- CALL SetErrStat( ErrID_Fatal, 'User input wave data not applicable for floating platforms.', ErrStat, ErrMsg, RoutineName)
- CALL Cleanup()
- RETURN
-
ENDSELECT
end if
@@ -1358,9 +1301,6 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
end if
! Set Initialization data for the Conv_Rdtn submodule
- ! Would be nice if there were a copy InitInput function in the *_Types file
- ! BJJ 6/25/2014: There is a copy InitInput function.... ???
-
CALL MOVE_ALLOC( HdroFreq, Conv_Rdtn_InitInp%HdroFreq )
CALL MOVE_ALLOC( HdroAddMs, Conv_Rdtn_InitInp%HdroAddMs )
CALL MOVE_ALLOC( HdroDmpng, Conv_Rdtn_InitInp%HdroDmpng )
@@ -1821,11 +1761,10 @@ SUBROUTINE WAMIT_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState
END SUBROUTINE WAMIT_UpdateStates
!----------------------------------------------------------------------------------------------------------------------------------
!> Routine for computing outputs, used in both loose and tight coupling.
-SUBROUTINE WAMIT_CalcOutput( Time, WaveTime, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
+SUBROUTINE WAMIT_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
!..................................................................................................................................
REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds
- real(SiKi), intent(in ) :: WaveTime(:) !< Array of wave kinematic time samples, (sec)
TYPE(WAMIT_InputType), INTENT(IN ) :: u !< Inputs at Time
TYPE(WAMIT_ParameterType), INTENT(IN ) :: p !< Parameters
TYPE(WAMIT_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time
@@ -1880,8 +1819,8 @@ SUBROUTINE WAMIT_CalcOutput( Time, WaveTime, u, p, x, xd, z, OtherState, y, m, E
END IF
DO I = 1,6*p%NBody ! Loop through all wave excitation forces and moments
- m%F_Waves1(I) = InterpWrappedStpReal ( REAL(Time, SiKi), WaveTime(:), p%WaveExctn(:,I), &
- m%LastIndWave, p%NStepWave + 1 )
+ m%F_Waves1(I) = InterpWrappedStpReal ( REAL(Time, SiKi), p%WaveField%WaveTime, p%WaveExctn(:,I), &
+ m%LastIndWave, p%WaveField%NStepWave + 1 )
END DO ! I - All wave excitation forces and moments
else ! p%ExctnDisp > 0
IF ( .NOT. allocated ( p%WaveExctnGrid ) ) THEN
@@ -1903,7 +1842,7 @@ SUBROUTINE WAMIT_CalcOutput( Time, WaveTime, u, p, x, xd, z, OtherState, y, m, E
END IF
iStart = (iBody-1)*6+1
! WaveExctnGrid dimensions are: 1st: wavetime, 2nd: X, 3rd: Y, 4th: Force component for each WAMIT Body
- m%F_Waves1(iStart:iStart+5) = SeaSt_Interp_3D_Vec6( Time, bodyPosition, p%WaveExctnGrid(:,:,:,iStart:iStart+5), p%SeaSt_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ m%F_Waves1(iStart:iStart+5) = SeaSt_Interp_3D_Vec6( Time, bodyPosition, p%WaveExctnGrid(:,:,:,iStart:iStart+5), p%WaveField%SeaSt_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SeaState_CalcOutput' )
END DO
end if
diff --git a/modules/hydrodyn/src/WAMIT.txt b/modules/hydrodyn/src/WAMIT.txt
index 9a9d912e56..51c0294603 100644
--- a/modules/hydrodyn/src/WAMIT.txt
+++ b/modules/hydrodyn/src/WAMIT.txt
@@ -17,11 +17,11 @@ usefrom Conv_Radiation.txt
usefrom SS_Radiation.txt
usefrom SS_Excitation.txt
usefrom SeaState_Interp.txt
+usefrom SeaSt_WaveField.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]" -
typedef ^ ^ ReKi Gravity - - - "Supplied by Driver: Gravitational acceleration" "(m/s^2)"
-typedef ^ ^ ReKi WtrDpth - - - "Water depth (positive-valued)" m
typedef ^ ^ ReKi PtfmVol0 {:} - - "" -
typedef ^ ^ LOGICAL HasWAMIT - - - ".TRUE. if using WAMIT model, .FALSE. otherwise" -
typedef ^ ^ ReKi WAMITULEN - - - "" -
@@ -36,24 +36,10 @@ typedef ^ ^ INTEGER
typedef ^ ^ INTEGER ExctnDisp - - - "0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0]" -
typedef ^ ^ ReKi ExctnCutOff - - - "Cutoff (corner) frequency of the low-pass time-filtered displaced position (Hz) [>0.0] " Hz
typedef ^ ^ DbKi RdtnTMax - - - "" -
-typedef ^ ^ ReKi WaveDir - - - "" -
typedef ^ ^ CHARACTER(1024) WAMITFile - - - "" -
typedef ^ ^ Conv_Rdtn_InitInputType Conv_Rdtn - - - "" -
-typedef ^ ^ ReKi Rhoxg - - - "" -
-typedef ^ ^ INTEGER NStepWave - - - "" -
-typedef ^ ^ INTEGER NStepWave2 - - - "" -
-typedef ^ ^ ReKi WaveDOmega - - - "" -
-typedef ^ ^ SiKi WaveElev0 {*} - - "Wave elevation time history at origin (needed for SS_Excitation module)" m
-typedef ^ ^ SiKi WaveElev1 {*}{*}{*} - - "First order wave elevation (points to SeaState module data)" -
-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 (points to SeaState module data)" (meters)
-typedef ^ ^ SiKi WaveElevC {*}{*}{*} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (meters)
-typedef ^ ^ SiKi WaveTime {*} - - "(points to SeaState module data)" -
-typedef ^ ^ INTEGER WaveMod - - - "" -
-typedef ^ ^ ReKi WtrDens - - - "" -
-typedef ^ ^ SiKi WaveDirArr {*} - - "Array of wave directions (one per frequency) from the Waves module (points to SeaState module data)" -
-typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction from Waves module" -
-typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction from Waves module" -
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
+
#
#
# Define outputs from the initialization routine here:
@@ -125,12 +111,11 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi ExctnFiltConst - - - "Low-pass time filter constant computed from ExctnCutOff"
typedef ^ ^ SiKi WaveExctn {:}{:} - - "" -
typedef ^ ^ SiKi WaveExctnGrid {:}{:}{:}{:} - - "WaveExctnGrid dimensions are: 1st: wavetime, 2nd: X, 3rd: Y, 4th: Force component for eac WAMIT Body" -
-typedef ^ ^ INTEGER NStepWave - - - "" -
typedef ^ ^ Conv_Rdtn_ParameterType Conv_Rdtn - - - "" -
typedef ^ ^ SS_Rad_ParameterType SS_Rdtn - - - "" -
typedef ^ ^ SS_Exc_ParameterType SS_Exctn - - - "" -
typedef ^ ^ DbKi DT - - - "" -
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
#
#
# ..... Inputs ....................................................................................................................
diff --git a/modules/hydrodyn/src/WAMIT2.f90 b/modules/hydrodyn/src/WAMIT2.f90
index cf28edda86..21c4f18ffc 100644
--- a/modules/hydrodyn/src/WAMIT2.f90
+++ b/modules/hydrodyn/src/WAMIT2.f90
@@ -813,7 +813,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
!> 1. Check the data to see if low cutoff on the difference frequency is 0. If it is above zero, that implies no mean drift
!! term since \f$ \omega_1=\omega_2 \f$
- IF ( InitInp%WvLowCOffD > 0.0_SiKi ) THEN
+ IF ( InitInp%WaveField%WvLowCOffD > 0.0_SiKi ) THEN
CALL SetErrStat( ErrID_Warn, ' WvLowCOffD > 0.0, so no mean drift term is calculated (the mean drift uses only the equal '//&
'frequency terms of the QTF). Setting the mean drift force to 0.',ErrStat,ErrMsg,RoutineName)
RETURN
@@ -828,7 +828,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
IF ( MnDriftData%DataIs3D ) THEN
! Check the low frequency cutoff
- IF ( MINVAL( MnDriftData%Data3D%WvFreq1 ) > InitInp%WvLowCOffD ) THEN
+ IF ( MINVAL( MnDriftData%Data3D%WvFreq1 ) > InitInp%WaveField%WvLowCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(MnDriftData%Data3D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(MnDriftData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffD.',ErrStat,ErrMsg,RoutineName)
@@ -836,7 +836,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( (MAXVAL(MnDriftData%Data3D%WvFreq1 ) < InitInp%WvHiCOffD) ) THEN
+ IF ( (MAXVAL(MnDriftData%Data3D%WvFreq1 ) < InitInp%WaveField%WvHiCOffD) ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(MnDriftData%Data3D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(MnDriftData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffD.',ErrStat,ErrMsg,RoutineName)
@@ -845,12 +845,12 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
ELSE IF ( MnDriftData%DataIs4D ) THEN ! only check if not 3D data. If there is 3D data, we default to using it for calculations
! Check the low frequency cutoff
- IF ( MINVAL( MnDriftData%Data4D%WvFreq1 ) > InitInp%WvLowCOffD ) THEN
+ IF ( MINVAL( MnDriftData%Data4D%WvFreq1 ) > InitInp%WaveField%WvLowCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(MnDriftData%Data4D%WvFreq1)))// &
' rad/s first wave period) data in '//TRIM(MnDriftData%Filename)// &
- ' is above the low frequency cutoff set by WvLowCOff.',ErrStat,ErrMsg,RoutineName)
+ ' is above the low frequency cutoff set by WvLowCOffD.',ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MINVAL( MnDriftData%Data4D%WvFreq2 ) > InitInp%WvLowCOff ) THEN
+ IF ( MINVAL( MnDriftData%Data4D%WvFreq2 ) > InitInp%WaveField%WvLowCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(MnDriftData%Data4D%WvFreq2)))// &
' rad/s for second wave period) data in '//TRIM(MnDriftData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffD.',ErrStat,ErrMsg,RoutineName)
@@ -858,12 +858,12 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( (MAXVAL(MnDriftData%Data4D%WvFreq1) < InitInp%WvHiCOffD) ) THEN
+ IF ( (MAXVAL(MnDriftData%Data4D%WvFreq1) < InitInp%WaveField%WvHiCOffD) ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(MnDriftData%Data4D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(MnDriftData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffD.',ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( (MAXVAL(MnDriftData%Data4D%WvFreq2) < InitInp%WvHiCOffD) ) THEN
+ IF ( (MAXVAL(MnDriftData%Data4D%WvFreq2) < InitInp%WaveField%WvHiCOffD) ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(MnDriftData%Data4D%WvFreq1)))// &
' rad/s second wave period) data in '//TRIM(MnDriftData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffD.',ErrStat,ErrMsg,RoutineName)
@@ -882,12 +882,12 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
IF ( MnDriftData%DataIs3D ) THEN
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (MnDriftData%Data3D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (MnDriftData%Data3D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(MnDriftData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(MnDriftData%Data3D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (MnDriftData%Data3D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (MnDriftData%Data3D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(MnDriftData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(MnDriftData%Data3D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -898,7 +898,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(minval(MnDriftData%data3d%WvDir1) > 150.0_SiKi) .OR. (maxval(MnDriftData%data3d%WvDir1) < -150.0_SiKi) .OR. &
(minval(MnDriftData%data3d%WvDir2) > 150.0_SiKi) .OR. (maxval(MnDriftData%data3d%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -908,13 +908,13 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(MnDriftData%Data3D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(MnDriftData%Data3D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(MnDriftData%Data3D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(MnDriftData%Data3D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -922,13 +922,13 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(MnDriftData%Data3D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(MnDriftData%Data3D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(MnDriftData%Data3D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(MnDriftData%Data3D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -938,12 +938,12 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
ELSEIF ( MnDriftData%DataIs4D ) THEN
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (MnDriftData%Data4D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (MnDriftData%Data4D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(MnDriftData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(MnDriftData%Data4D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (MnDriftData%Data4D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (MnDriftData%Data4D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(MnDriftData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(MnDriftData%Data4D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -954,7 +954,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(MINVAL(MnDriftData%Data4D%WvDir1) > 150.0_SiKi) .OR. (MAXVAL(MnDriftData%Data4D%WvDir1) < -150.0_SiKi) .OR. &
(MINVAL(MnDriftData%Data4D%WvDir2) > 150.0_SiKi) .OR. (MAXVAL(MnDriftData%Data4D%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -965,13 +965,13 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
! --> FIXME: modify to allow shifting values by TwoPi before comparing
- IF ( InitInp%WaveDirMin < MINVAL(MnDriftData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(MnDriftData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(MnDriftData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(MnDriftData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -979,13 +979,13 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(MnDriftData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(MnDriftData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(MnDriftData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(MnDriftData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(MnDriftData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -1137,31 +1137,28 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
END IF
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! NOTE: since the Mean Drift only returns a static time independent average value for the drift force, we do not
! need to account for any offset in the location of the WAMIT body (this term vanishes).
! First get the wave amplitude -- must be reconstructed from the WaveElevC0 array. First index is the real (1) or
! imaginary (2) part. Divide by NStepWave2 to remove the built in normalization in WaveElevC0.
- aWaveElevC = CMPLX( InitInp%WaveElevC0(1,J), InitInp%WaveElevC0(2,J), SiKi) / InitInp%NStepWave2
+ aWaveElevC = CMPLX( InitInp%WaveField%WaveElevC0(1,J), InitInp%WaveField%WaveElevC0(2,J), SiKi) / InitInp%WaveField%NStepWave2
! Calculate the frequency
- Omega1 = J * InitInp%WaveDOmega
+ Omega1 = J * InitInp%WaveField%WaveDOmega
! Only get a QTF value if within the range of frequencies we have wave amplitudes for (first order cutoffs). This
! is done only for efficiency.
- !BJJ: If WaveMod==1, this could result in zeroing out the wrong values...
- !InitInp%WvLowCOff and InitInp%WvHiCOff are not used in SeaState when WaveMod = 0,1, or 6
- ! Probably could just remove this IF statement????
- IF ( (Omega1 >= InitInp%WvLowCOff) .AND. (Omega1 <= InitInp%WvHiCOff) ) THEN
+ IF ( (Omega1 >= InitInp%WaveField%WvLowCOff) .AND. (Omega1 <= InitInp%WaveField%WvHiCOff) ) THEN
! Now get the QTF value that corresponds to this frequency and wavedirection pair.
IF ( MnDriftData%DataIs3D ) THEN
! Set the (omega1,beta1,beta2) point we are looking for. (angles in degrees here)
- Coord3 = (/ REAL(Omega1,SiKi), InitInp%WaveDirArr(J), InitInp%WaveDirArr(J) /)
+ Coord3 = (/ REAL(Omega1,SiKi), InitInp%WaveField%WaveDirArr(J), InitInp%WaveField%WaveDirArr(J) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord3(2) = Coord3(2) - RotateZdegOffset
@@ -1175,7 +1172,7 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS
ELSE
! Set the (omega1,omega2,beta1,beta2) point we are looking for. (angles in degrees here)
- Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveDirArr(J), InitInp%WaveDirArr(J) /)
+ Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveField%WaveDirArr(J), InitInp%WaveField%WaveDirArr(J) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord4(3) = Coord4(3) - RotateZdegOffset
@@ -1352,12 +1349,10 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
!> 1. Check the data to see if the wave frequencies are present in the QTF data. Since Newman's approximation only uses
!! frequencies where \f$ \omega_1=\omega_2 \f$, the data read in from the files must contain the full range of frequencies
!! present in the waves.
-!bjj: InitInp%WvLowCOff and InitInp%WvHiCOff aren't supposed to be used when WaveMod=0, 1, or 6, but they are used here regardless of those conditions.
-! Can we get rid of these checks????
IF ( NewmanAppData%DataIs3D ) THEN
! Check the low frequency cutoff
- IF ( MINVAL( NewmanAppData%Data3D%WvFreq1 ) > InitInp%WvLowCOff ) THEN
+ IF ( MINVAL( NewmanAppData%Data3D%WvFreq1 ) > InitInp%WaveField%WvLowCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(NewmanAppData%Data3D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is above the low frequency cutoff set by WvLowCOff.', &
@@ -1366,7 +1361,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( MAXVAL(NewmanAppData%Data3D%WvFreq1 ) < InitInp%WvHiCOff ) THEN
+ IF ( MAXVAL(NewmanAppData%Data3D%WvFreq1 ) < InitInp%WaveField%WvHiCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(NewmanAppData%Data3D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is below the high frequency cutoff set by WvHiCOff.', &
@@ -1376,13 +1371,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
ELSE IF ( NewmanAppData%DataIs4D ) THEN ! only check if not 3D data. If there is 3D data, we default to using it for calculations
! Check the low frequency cutoff
- IF ( MINVAL( NewmanAppData%Data4D%WvFreq1 ) > InitInp%WvLowCOff ) THEN
+ IF ( MINVAL( NewmanAppData%Data4D%WvFreq1 ) > InitInp%WaveField%WvLowCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(NewmanAppData%Data4D%WvFreq1)))// &
' rad/s first wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is above the low frequency cutoff set by WvLowCOff.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MINVAL( NewmanAppData%Data4D%WvFreq2 ) > InitInp%WvLowCOff ) THEN
+ IF ( MINVAL( NewmanAppData%Data4D%WvFreq2 ) > InitInp%WaveField%WvLowCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(NewmanAppData%Data4D%WvFreq2)))// &
' rad/s for second wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is above the low frequency cutoff set by WvLowCOff.', &
@@ -1391,13 +1386,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( MAXVAL(NewmanAppData%Data4D%WvFreq1) < InitInp%WvHiCOff ) THEN
+ IF ( MAXVAL(NewmanAppData%Data4D%WvFreq1) < InitInp%WaveField%WvHiCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(NewmanAppData%Data4D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is below the high frequency cutoff set by WvHiCOff.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MAXVAL(NewmanAppData%Data4D%WvFreq2) < InitInp%WvHiCOff ) THEN
+ IF ( MAXVAL(NewmanAppData%Data4D%WvFreq2) < InitInp%WaveField%WvHiCOff ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(NewmanAppData%Data4D%WvFreq1)))// &
' rad/s second wave period) data in '//TRIM(NewmanAppData%Filename)// &
' is below the high frequency cutoff set by WvHiCOff.', &
@@ -1417,12 +1412,12 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
IF ( NewmanAppData%DataIs3D ) THEN
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (NewmanAppData%Data3D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (NewmanAppData%Data3D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(NewmanAppData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(NewmanAppData%Data3D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (NewmanAppData%Data3D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (NewmanAppData%Data3D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(NewmanAppData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(NewmanAppData%Data3D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -1433,7 +1428,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(minval(NewmanAppData%data3d%WvDir1) > 150.0_SiKi) .OR. (maxval(NewmanAppData%data3d%WvDir1) < -150.0_SiKi) .OR. &
(minval(NewmanAppData%data3d%WvDir2) > 150.0_SiKi) .OR. (maxval(NewmanAppData%data3d%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -1443,13 +1438,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(NewmanAppData%Data3D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(NewmanAppData%Data3D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(NewmanAppData%Data3D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(NewmanAppData%Data3D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -1457,13 +1452,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(NewmanAppData%Data3D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(NewmanAppData%Data3D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(NewmanAppData%Data3D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(NewmanAppData%Data3D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -1473,12 +1468,12 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
ELSEIF ( NewmanAppData%DataIs4D ) THEN
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (NewmanAppData%Data4D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (NewmanAppData%Data4D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(NewmanAppData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(NewmanAppData%Data4D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (NewmanAppData%Data4D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (NewmanAppData%Data4D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(NewmanAppData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(NewmanAppData%Data4D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -1489,7 +1484,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(MINVAL(NewmanAppData%Data4D%WvDir1) > 150.0_SiKi) .OR. (MAXVAL(NewmanAppData%Data4D%WvDir1) < -150.0_SiKi) .OR. &
(MINVAL(NewmanAppData%Data4D%WvDir2) > 150.0_SiKi) .OR. (MAXVAL(NewmanAppData%Data4D%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -1500,13 +1495,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
! --> FIXME: modify to allow shifting values by TwoPi before comparing
- IF ( InitInp%WaveDirMin < MINVAL(NewmanAppData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(NewmanAppData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(NewmanAppData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(NewmanAppData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -1514,13 +1509,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(NewmanAppData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(NewmanAppData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(NewmanAppData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(NewmanAppData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(NewmanAppData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -1615,19 +1610,19 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Setup the arrays holding the Newman terms, both the complex frequency domain and real time domain pieces
- ALLOCATE( NewmanTerm1t( 0:InitInp%NStepWave ), STAT=ErrStatTmp )
+ ALLOCATE( NewmanTerm1t( 0:InitInp%WaveField%NStepWave ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for calculating the first term of the Newmans '// &
'approximation in the time domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( NewmanTerm2t( 0:InitInp%NStepWave ), STAT=ErrStatTmp )
+ ALLOCATE( NewmanTerm2t( 0:InitInp%WaveField%NStepWave ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for calculating the second term of the Newmans '// &
'approximation in the time domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( NewmanTerm1C( 0:InitInp%NStepWave2, 6 ), STAT=ErrStatTmp )
+ ALLOCATE( NewmanTerm1C( 0:InitInp%WaveField%NStepWave2, 6 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for calculating the first term of the Newmans '// &
'approximation in the frequency domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( NewmanTerm2C( 0:InitInp%NStepWave2, 6 ), STAT=ErrStatTmp )
+ ALLOCATE( NewmanTerm2C( 0:InitInp%WaveField%NStepWave2, 6 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for calculating the second term of the Newmans '// &
'approximation in the frequency domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( NewmanAppForce( 0:InitInp%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
+ ALLOCATE( NewmanAppForce( 0:InitInp%WaveField%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the resulting Newmans '// &
'approximation of the 2nd order force.',ErrStat, ErrMsg, RoutineName)
@@ -1651,7 +1646,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Initialize the FFT library
- CALL InitCFFT ( InitInp%NStepWave, FFT_Data, .FALSE., ErrStatTmp ) ! Complex result FFT initialize
+ CALL InitCFFT ( InitInp%WaveField%NStepWave, FFT_Data, .FALSE., ErrStatTmp ) ! Complex result FFT initialize
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
IF (ALLOCATED(TmpData3D)) DEALLOCATE(TmpData3D,STAT=ErrStatTmp)
@@ -1709,24 +1704,24 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
END IF
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! First get the wave amplitude -- must be reconstructed from the WaveElevC array. First index is the real (1) or
! imaginary (2) part. Divide by NStepWave2 so that the wave amplitude is of the same form as the paper.
- aWaveElevC = CMPLX( InitInp%WaveElevC0(1,J), InitInp%WaveElevC0(2,J), SiKi) / InitInp%NStepWave2
+ aWaveElevC = CMPLX( InitInp%WaveField%WaveElevC0(1,J), InitInp%WaveField%WaveElevC0(2,J), SiKi) / InitInp%WaveField%NStepWave2
! Calculate the frequency
- Omega1 = J * InitInp%WaveDOmega
+ Omega1 = J * InitInp%WaveField%WaveDOmega
! Only get a QTF value if within the range of frequencies between the cutoffs for the difference frequency
- IF ( (Omega1 >= InitInp%WvLowCOff) .AND. (Omega1 <= InitInp%WvHiCOff) ) THEN
+ IF ( (Omega1 >= InitInp%WaveField%WvLowCOff) .AND. (Omega1 <= InitInp%WaveField%WvHiCOff) ) THEN
! Now get the QTF value that corresponds to this frequency and wavedirection pair.
IF ( NewmanAppData%DataIs3D ) THEN
! Set the (omega1,beta1,beta2) point we are looking for.
- Coord3 = (/ REAL(Omega1,SiKi), InitInp%WaveDirArr(J), InitInp%WaveDirArr(J) /)
+ Coord3 = (/ REAL(Omega1,SiKi), InitInp%WaveField%WaveDirArr(J), InitInp%WaveField%WaveDirArr(J) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord3(2) = Coord3(2) - RotateZdegOffset
@@ -1739,7 +1734,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
ELSE
! Set the (omega1,omega2,beta1,beta2) point we are looking for.
- Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveDirArr(J), InitInp%WaveDirArr(J) /)
+ Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveField%WaveDirArr(J), InitInp%WaveField%WaveDirArr(J) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord4(3) = Coord4(3) - RotateZdegOffset
@@ -1796,7 +1791,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
ENDIF
- ENDDO ! J=1,InitInp%NStepWave2
+ ENDDO ! J=1,InitInp%WaveField%NStepWave2
ENDIF ! Load component to calculate
@@ -1813,10 +1808,10 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
RotateZMatrixT(:,2) = (/ sin(InitInp%PtfmRefztRot(IBody)), cos(InitInp%PtfmRefztRot(IBody)) /)
! Loop through all the frequencies
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! Frequency
- Omega1 = J * InitInp%WaveDOmega
+ Omega1 = J * InitInp%WaveField%WaveDOmega
!> Phase shift due to offset in location, only for NBodyMod==2
if (p%NBodyMod == 2) then
@@ -1827,8 +1822,8 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! of above is mathematically equivalent, but only because each frequency has only one wave
! direction associated with it through the equal energy approach used in multidirectional waves.
- WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(J)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(J)*D2R) )
+ WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(J)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(J)*D2R) )
PhaseShiftXY = CMPLX( cos(TmpReal1), -sin(TmpReal1) )
! Apply the phase shift
@@ -1847,7 +1842,7 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
NewmanTerm2C(J,1:2) = MATMUL(RotateZMatrixT, NewmanTerm2C(J,1:2))
NewmanTerm2C(J,4:5) = MATMUL(RotateZMatrixT, NewmanTerm2C(J,4:5))
- ENDDO ! J=1,InitInp%NStepWave2
+ ENDDO ! J=1,InitInp%WaveField%NStepWave2
@@ -1889,12 +1884,12 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg
! Now square the real part of the resulting time domain pieces and add them together to get the final force time series.
- DO J=0,InitInp%NStepWave-1
+ DO J=0,InitInp%WaveField%NStepWave-1
NewmanAppForce(J,Idx) = (abs(NewmanTerm1t(J)))**2 - (abs(NewmanTerm2t(J)))**2
ENDDO
! Copy the last first term to the last so that it is cyclic
- NewmanAppForce(InitInp%NStepWave,Idx) = NewmanAppForce(0,Idx)
+ NewmanAppForce(InitInp%WaveField%NStepWave,Idx) = NewmanAppForce(0,Idx)
ENDDO ! ThisDim -- index to current dimension
@@ -2028,13 +2023,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
IF ( DiffQTFData%DataIs4D ) THEN ! We must have a 4D data set
! Check the low frequency cutoff
- IF ( MINVAL( DiffQTFData%Data4D%WvFreq1 ) > InitInp%WvLowCOffD ) THEN
+ IF ( MINVAL( DiffQTFData%Data4D%WvFreq1 ) > InitInp%WaveField%WvLowCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(DiffQTFData%Data4D%WvFreq1)))// &
' rad/s first wave period) data in '//TRIM(DiffQTFData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffD.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MINVAL( DiffQTFData%Data4D%WvFreq2 ) > InitInp%WvLowCOffD ) THEN
+ IF ( MINVAL( DiffQTFData%Data4D%WvFreq2 ) > InitInp%WaveField%WvLowCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(DiffQTFData%Data4D%WvFreq2)))// &
' rad/s for second wave period) data in '//TRIM(DiffQTFData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffD.', &
@@ -2043,13 +2038,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( MAXVAL(DiffQTFData%Data4D%WvFreq1) < InitInp%WvHiCOffD ) THEN
+ IF ( MAXVAL(DiffQTFData%Data4D%WvFreq1) < InitInp%WaveField%WvHiCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(DiffQTFData%Data4D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(DiffQTFData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffD.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MAXVAL(DiffQTFData%Data4D%WvFreq2) < InitInp%WvHiCOffD ) THEN
+ IF ( MAXVAL(DiffQTFData%Data4D%WvFreq2) < InitInp%WaveField%WvHiCOffD ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(DiffQTFData%Data4D%WvFreq1)))// &
' rad/s second wave period) data in '//TRIM(DiffQTFData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffD.', &
@@ -2067,12 +2062,12 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (DiffQTFData%Data4D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (DiffQTFData%Data4D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(DiffQTFData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(DiffQTFData%Data4D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (DiffQTFData%Data4D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (DiffQTFData%Data4D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(DiffQTFData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(DiffQTFData%Data4D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -2083,7 +2078,7 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(MINVAL(DiffQTFData%Data4D%WvDir1) > 150.0_SiKi) .OR. (MAXVAL(DiffQTFData%Data4D%WvDir1) < -150.0_SiKi) .OR. &
(MINVAL(DiffQTFData%Data4D%WvDir2) > 150.0_SiKi) .OR. (MAXVAL(DiffQTFData%Data4D%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -2094,13 +2089,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
! --> FIXME: modify to allow shifting values by TwoPi before comparing
- IF ( InitInp%WaveDirMin < MINVAL(DiffQTFData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(DiffQTFData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(DiffQTFData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(DiffQTFData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(DiffQTFData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(DiffQTFData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -2108,13 +2103,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(DiffQTFData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(DiffQTFData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(DiffQTFData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(DiffQTFData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(DiffQTFData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(DiffQTFData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -2156,13 +2151,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Setup the arrays holding the DiffQTF terms, both the complex frequency domain and real time domain pieces
- ALLOCATE( TmpDiffQTFForce( 0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE( TmpDiffQTFForce( 0:InitInp%WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for one load component of the full difference '// &
'QTF 2nd order force time series.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( TmpComplexArr( 0:InitInp%NStepWave2, 6), STAT=ErrStatTmp )
+ ALLOCATE( TmpComplexArr( 0:InitInp%WaveField%NStepWave2, 6), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for one load component of the full difference '// &
'QTF 2nd order force in the frequency domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( DiffQTFForce( 0:InitInp%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
+ ALLOCATE( DiffQTFForce( 0:InitInp%WaveField%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the full difference '// &
'QTF 2nd order force time series.',ErrStat, ErrMsg, RoutineName)
@@ -2178,7 +2173,7 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Initialize the FFT library. Do not apply normalization.
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
+ CALL InitFFT ( InitInp%WaveField%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
call cleanup()
@@ -2245,32 +2240,32 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
TmpData4D = DiffQTFData%Data4D%DataSet(:,:,:,:,Idx)
! Outer loop to create the TmpComplexArr
- DO J=1,InitInp%NStepWave2-1
+ DO J=1,InitInp%WaveField%NStepWave2-1
! Calculate the frequency -- This is the difference frequency.
- OmegaDiff = J * InitInp%WaveDOmega
+ OmegaDiff = J * InitInp%WaveField%WaveDOmega
! Only perform calculations if the difference frequency is in the right range
- IF ( (OmegaDiff >= InitInp%WvLowCOffD) .AND. (OmegaDiff <= InitInp%WvHiCOffD) ) THEN
+ IF ( (OmegaDiff >= InitInp%WaveField%WvLowCOffD) .AND. (OmegaDiff <= InitInp%WaveField%WvHiCOffD) ) THEN
! Set the \f$ H^- \f$ term to zero before we start
TmpHMinusC = CMPLX(0.0_SiKi,0.0_SiKi,SiKi)
! Do the sum over H^-
- DO K=1,InitInp%NStepWave2-J ! note the funny upper limit. This is because we are doing a summation on a triangular area.
+ DO K=1,InitInp%WaveField%NStepWave2-J ! note the funny upper limit. This is because we are doing a summation on a triangular area.
! set the two frequencies that the difference frequency comes from
- Omega1 = (J + K) * InitInp%WaveDOmega ! the mth frequency -- \mu^- + n = m
- Omega2 = K * InitInp%WaveDOmega ! the nth frequency
+ Omega1 = (J + K) * InitInp%WaveField%WaveDOmega ! the mth frequency -- \mu^- + n = m
+ Omega2 = K * InitInp%WaveField%WaveDOmega ! the nth frequency
! Find the Wave amplitudes 1 and 2
- aWaveElevC1 = CMPLX( InitInp%WaveElevC0(1,J+K), InitInp%WaveElevC0(2,J+K), SiKi) / InitInp%NStepWave2
- aWaveElevC2 = CMPLX( InitInp%WaveElevC0(1,K), InitInp%WaveElevC0(2,K), SiKi) / InitInp%NStepWave2
+ aWaveElevC1 = CMPLX( InitInp%WaveField%WaveElevC0(1,J+K), InitInp%WaveField%WaveElevC0(2,J+K), SiKi) / InitInp%WaveField%NStepWave2
+ aWaveElevC2 = CMPLX( InitInp%WaveField%WaveElevC0(1,K), InitInp%WaveField%WaveElevC0(2,K), SiKi) / InitInp%WaveField%NStepWave2
! Set the (omega1,omega2,beta1,beta2) point we are looking for.
- Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega2,SiKi), InitInp%WaveDirArr(J+K), InitInp%WaveDirArr(K) /)
+ Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega2,SiKi), InitInp%WaveField%WaveDirArr(J+K), InitInp%WaveField%WaveDirArr(K) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord4(3) = Coord4(3) - RotateZdegOffset
@@ -2296,10 +2291,10 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! of above is mathematically equivalent, but only because each frequency has only one wave
! direction associated with it through the equal energy approach used in multidirectional waves.
- WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- WaveNmbr2 = WaveNumber ( REAL(Omega2,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(J+K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(J+K)*D2R) )
- TmpReal2 = WaveNmbr2 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(K)*D2R) )
+ WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ WaveNmbr2 = WaveNumber ( REAL(Omega2,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(J+K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(J+K)*D2R) )
+ TmpReal2 = WaveNmbr2 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(K)*D2R) )
! Set the phase shift for the set of difference frequencies
PhaseShiftXY = CMPLX( cos(TmpReal1 - TmpReal2), -sin(TmpReal1 - TmpReal2) )
@@ -2340,13 +2335,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
RotateZMatrixT(:,2) = (/ sin(InitInp%PtfmRefztRot(IBody)), cos(InitInp%PtfmRefztRot(IBody)) /)
! Loop through all the frequencies
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! Apply the rotation to get back to global frame
TmpComplexArr(J,1:2) = MATMUL(RotateZMatrixT, TmpComplexArr(J,1:2))
TmpComplexArr(J,4:5) = MATMUL(RotateZMatrixT, TmpComplexArr(J,4:5))
- ENDDO ! J=1,InitInp%NStepWave2
+ ENDDO ! J=1,InitInp%WaveField%NStepWave2
@@ -2369,13 +2364,13 @@ SUBROUTINE DiffQTF_InitCalc( InitInp, p, DiffQTFData, DiffQTFForce, ErrMsg, ErrS
! Now we multiply the result by 2 and save it to the DiffQTFForce array and add the MnDrift term
! NOTE: phase shift and orientations on the MnDriftForce term have already been applied
- ! NOTE: the "-1" since TmpDiffQTFForce(InitInp%NStepWave) is not set and DiffQTFForce(InitInp%NStepWave,Idx) gets overwritten
- DO K=0,InitInp%NStepWave-1
+ ! NOTE: the "-1" since TmpDiffQTFForce(InitInp%WaveField%NStepWave) is not set and DiffQTFForce(InitInp%WaveField%NStepWave,Idx) gets overwritten
+ DO K=0,InitInp%WaveField%NStepWave-1
DiffQTFForce(K,Idx) = 2.0_SiKi * TmpDiffQTFForce(K) + MnDriftForce(Idx)
ENDDO
! Copy the last first term to the first so that it is cyclic
- DiffQTFForce(InitInp%NStepWave,Idx) = DiffQTFForce(0,Idx)
+ DiffQTFForce(InitInp%WaveField%NStepWave,Idx) = DiffQTFForce(0,Idx)
ENDDO ! ThisDim -- The current dimension
ENDDO ! IBody -- This WAMIT body
@@ -2534,13 +2529,13 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
IF ( SumQTFData%DataIs4D ) THEN ! We must have a 4D data set
! Check the low frequency cutoff
- IF ( MINVAL( SumQTFData%Data4D%WvFreq1 ) > InitInp%WvLowCOffS ) THEN
+ IF ( MINVAL( SumQTFData%Data4D%WvFreq1 ) > InitInp%WaveField%WvLowCOffS ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(SumQTFData%Data4D%WvFreq1)))// &
' rad/s first wave period) data in '//TRIM(SumQTFData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffS.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MINVAL( SumQTFData%Data4D%WvFreq2 ) > InitInp%WvLowCOffS ) THEN
+ IF ( MINVAL( SumQTFData%Data4D%WvFreq2 ) > InitInp%WaveField%WvLowCOffS ) THEN
CALL SetErrStat( ErrID_Fatal,' The lowest frequency ( '//TRIM(Num2LStr(MINVAL(SumQTFData%Data4D%WvFreq2)))// &
' rad/s for second wave period) data in '//TRIM(SumQTFData%Filename)// &
' is above the low frequency cutoff set by WvLowCOffS.', &
@@ -2549,13 +2544,13 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Check the high frequency cutoff -- using the Difference high frequency cutoff. The first order high frequency
! cutoff is typically too high for this in most cases.
- IF ( MAXVAL(SumQTFData%Data4D%WvFreq1) < InitInp%WvHiCOffS ) THEN
+ IF ( MAXVAL(SumQTFData%Data4D%WvFreq1) < InitInp%WaveField%WvHiCOffS ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(SumQTFData%Data4D%WvFreq1)))// &
' rad/s for first wave period) data in '//TRIM(SumQTFData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffS.', &
ErrStat,ErrMsg,RoutineName)
ENDIF
- IF ( MAXVAL(SumQTFData%Data4D%WvFreq2) < InitInp%WvHiCOffS ) THEN
+ IF ( MAXVAL(SumQTFData%Data4D%WvFreq2) < InitInp%WaveField%WvHiCOffS ) THEN
CALL SetErrStat( ErrID_Fatal,' The highest frequency ( '//TRIM(Num2LStr(MAXVAL(SumQTFData%Data4D%WvFreq1)))// &
' rad/s second wave period) data in '//TRIM(SumQTFData%Filename)// &
' is below the high frequency cutoff set by WvHiCOffS.', &
@@ -2573,12 +2568,12 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! If we are using multidirectional waves, then we should have more than 1 wave direction in the WAMIT file.
- IF ( InitInp%WaveMultiDir .AND. (SumQTFData%Data4D%NumWvDir1 == 1) ) THEN
+ IF ( InitInp%WaveField%WaveMultiDir .AND. (SumQTFData%Data4D%NumWvDir1 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(SumQTFData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(SumQTFData%Data4D%WvDir1(1)))//' degrees (first wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
ErrStat,ErrMsg,RoutineName)
- ELSE IF ( InitInp%WaveMultiDir .AND. (SumQTFData%Data4D%NumWvDir2 == 1) ) THEN
+ ELSE IF ( InitInp%WaveField%WaveMultiDir .AND. (SumQTFData%Data4D%NumWvDir2 == 1) ) THEN
CALL SetErrStat( ErrID_Fatal,' WAMIT output file '//TRIM(SumQTFData%Filename)//' only contains one wave '// &
'direction at '//TRIM(Num2LStr(SumQTFData%Data4D%WvDir2(1)))//' degrees (second wave direction). '// &
'It cannot be used with multidirectional waves. Set WaveDirMod to 0 to use this file.', &
@@ -2589,7 +2584,7 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! now (since time is limited) we will issue a warning if any of the wave directions for multidirectional waves
! or data from the WAMIT file for the wavedirections is close to the +/-pi boundary (>150 degrees, <-150 degrees),
! we will issue a warning.
- IF ( (InitInp%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveDirMax < -150.0_SiKi) .OR. &
+ IF ( (InitInp%WaveField%WaveDirMin > 150.0_SiKi) .OR. (InitInp%WaveField%WaveDirMax < -150.0_SiKi) .OR. &
(MINVAL(SumQTFData%Data4D%WvDir1) > 150.0_SiKi) .OR. (MAXVAL(SumQTFData%Data4D%WvDir1) < -150.0_SiKi) .OR. &
(MINVAL(SumQTFData%Data4D%WvDir2) > 150.0_SiKi) .OR. (MAXVAL(SumQTFData%Data4D%WvDir2) < -150.0_SiKi) ) THEN
CALL SetErrStat( ErrID_Warn,' There may be issues with how the wave direction data is handled when the wave '// &
@@ -2600,13 +2595,13 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Now check the limits for the first wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
! --> FIXME: modify to allow shifting values by TwoPi before comparing
- IF ( InitInp%WaveDirMin < MINVAL(SumQTFData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(SumQTFData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(SumQTFData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(SumQTFData%Data4D%WvDir1) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(SumQTFData%Data4D%WvDir1) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(SumQTFData%Filename)//' for the first wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -2614,13 +2609,13 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Now check the limits for the second wave direction
! --> FIXME: sometime fix this to handle the above case. See Known Issue #1 at top of file.
- IF ( InitInp%WaveDirMin < MINVAL(SumQTFData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMin))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMin < MINVAL(SumQTFData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Minimum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMin))//' is not'//&
'found in the WAMIT data file '//TRIM(SumQTFData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
- IF ( InitInp%WaveDirMax > MAXVAL(SumQTFData%Data4D%WvDir2) ) THEN
- CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveDirMax))//' is not'//&
+ IF ( InitInp%WaveField%WaveDirMax > MAXVAL(SumQTFData%Data4D%WvDir2) ) THEN
+ CALL SetErrStat( ErrID_Fatal,' Maximum wave direction required of '//TRIM(Num2LStr(InitInp%WaveField%WaveDirMax))//' is not'//&
'found in the WAMIT data file '//TRIM(SumQTFData%Filename)//' for the second wave direction.', &
ErrStat, ErrMsg, RoutineName)
ENDIF
@@ -2662,19 +2657,19 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Setup the arrays holding the SumQTF terms, both the complex frequency domain and real time domain pieces
- ALLOCATE( Term1ArrayC( 0:InitInp%NStepWave2, 6), STAT=ErrStatTmp )
+ ALLOCATE( Term1ArrayC( 0:InitInp%WaveField%NStepWave2, 6), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the first term of one load component of the full sum '// &
'QTF 2nd order force in the frequency domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( Term2ArrayC( 0:InitInp%NStepWave2, 6), STAT=ErrStatTmp )
+ ALLOCATE( Term2ArrayC( 0:InitInp%WaveField%NStepWave2, 6), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the second term of one load component of the full sum '// &
'QTF 2nd order force in the frequency domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( Term1Array( 0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE( Term1Array( 0:InitInp%WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the first term of one load component of the full sum '// &
'QTF 2nd order force in the time domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( Term2Array( 0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE( Term2Array( 0:InitInp%WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the second term of one load component of the full sum '// &
'QTF 2nd order force in the time domain.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE( SumQTFForce( 0:InitInp%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
+ ALLOCATE( SumQTFForce( 0:InitInp%WaveField%NStepWave, 6*p%NBody), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,' Cannot allocate array for the full difference '// &
'QTF 2nd order force time series.',ErrStat, ErrMsg, RoutineName)
@@ -2694,7 +2689,7 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Initialize the FFT library. Normalization not required in this formulation.
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .FALSE., ErrStatTmp ) ! FIXME:
+ CALL InitFFT ( InitInp%WaveField%NStepWave, FFT_Data, .FALSE., ErrStatTmp ) ! FIXME:
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
IF (ALLOCATED(TmpData4D)) DEALLOCATE(TmpData4D,STAT=ErrStatTmp)
@@ -2749,21 +2744,21 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! The limits look a little funny. But remember we are placing the value in the 2*J location,
! so we cannot overun the end of the array, and the highest frequency must be zero. The
! floor function is just in case (NStepWave2 - 1) is an odd number
- DO J=1,FLOOR(REAL(InitInp%NStepWave2-1)/2.0_SiKi)
+ DO J=1,FLOOR(REAL(InitInp%WaveField%NStepWave2-1)/2.0_SiKi)
! The frequency
- Omega1 = REAL(J,ReKi) * InitInp%WaveDOmega
+ Omega1 = REAL(J,ReKi) * InitInp%WaveField%WaveDOmega
OmegaSum = 2.0_SiKi * Omega1 ! the sum frequency
! Only perform calculations if the difference frequency is in the right range
- IF ( (OmegaSum >= InitInp%WvLowCOffS) .AND. (OmegaSum <= InitInp%WvHiCOffS) ) THEN
+ IF ( (OmegaSum >= InitInp%WaveField%WvLowCOffS) .AND. (OmegaSum <= InitInp%WaveField%WvHiCOffS) ) THEN
! Find the wave amplitude at frequency omega
- aWaveElevC1 = CMPLX( InitInp%WaveElevC0(1,J), InitInp%WaveElevC0(2,J), SiKi ) / InitInp%NStepWave2
+ aWaveElevC1 = CMPLX( InitInp%WaveField%WaveElevC0(1,J), InitInp%WaveField%WaveElevC0(2,J), SiKi ) / InitInp%WaveField%NStepWave2
! Set the (omega1,omega2,beta1,beta2) point we are looking for.
- Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveDirArr(J), InitInp%WaveDirArr(J) /)
+ Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega1,SiKi), InitInp%WaveField%WaveDirArr(J), InitInp%WaveField%WaveDirArr(J) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord4(3) = Coord4(3) - RotateZdegOffset
@@ -2790,8 +2785,8 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! of above is mathematically equivalent, but only because each frequency has only one wave
! direction associated with it through the equal energy approach used in multidirectional waves.
- WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(J)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(J)*D2R) )
+ WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(J)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(J)*D2R) )
! Set the phase shift for the set of sum frequencies
PhaseShiftXY = CMPLX( cos(TmpReal1 + TmpReal1), -sin(TmpReal1 + TmpReal1) )
@@ -2832,11 +2827,11 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! so, we don't need a really small WaveDT
!This section has been removed since it is kind of annoying.
- ! IF ( InitInp%WvHiCOffS > InitInp%NStepWave2*InitInp%WaveDOmega ) THEN
+ ! IF ( InitInp%WvHiCOffS > InitInp%WaveField%NStepWave2*InitInp%WaveField%WaveDOmega ) THEN
! CALL SetErrStat( ErrID_Warn,' The high frequency cutoff for second order wave forces, WvHiCOffS, '// &
! 'is larger than the Nyquist frequency for the given time step of WaveDT. The Nyquist frequency '// &
! '(highest frequency) that can be computed is OmegaMax = PI/WaveDT = '// &
- ! TRIM(Num2LStr(InitInp%NStepWave2*InitInp%WaveDOmega))// &
+ ! TRIM(Num2LStr(InitInp%WaveField%NStepWave2*InitInp%WaveField%WaveDOmega))// &
! ' radians/second. If you need those frequencies, decrease WaveDT. For reference, 2*PI '// &
! 'radians/second corresponds to a wavelength of ~1 meter.',&
! ErrStat,ErrMsg,RoutineName)
@@ -2845,10 +2840,10 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Outer loop to create the Term2ArrayC. This is stepwise through the sum frequencies.
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! Calculate the frequency -- This is the sum frequency.
- OmegaSum = J * InitInp%WaveDOmega
+ OmegaSum = J * InitInp%WaveField%WaveDOmega
@@ -2857,7 +2852,7 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! Only perform calculations if the difference frequency is in the right range
- IF ( (OmegaSum >= InitInp%WvLowCOffS) .AND. (OmegaSum <= InitInp%WvHiCOffS) ) THEN
+ IF ( (OmegaSum >= InitInp%WaveField%WvLowCOffS) .AND. (OmegaSum <= InitInp%WaveField%WvHiCOffS) ) THEN
!> Now do the inner sum. We are going to perform a sum up to the maximum frequency that we
!! can support (Nyquist frequency) for the given WaveDOmega and NStepWave2 (WaveOmegaMax =
@@ -2869,15 +2864,15 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
DO K=0,FLOOR(Real(J-1)/2.0_SiKi)
! Calculate the frequency pair
- Omega1 = K * InitInp%WaveDOmega
- Omega2 = (J-K) * InitInp%WaveDOmega
+ Omega1 = K * InitInp%WaveField%WaveDOmega
+ Omega2 = (J-K) * InitInp%WaveField%WaveDOmega
! Find the wave amplitude at frequency omega. Remove the NStepWave2 normalization built into WaveElevC0 from Waves module
- aWaveElevC1 = CMPLX( InitInp%WaveElevC0(1, K), InitInp%WaveElevC0(2, K), SiKi ) / InitInp%NStepWave2
- aWaveElevC2 = CMPLX( InitInp%WaveElevC0(1,J-K), InitInp%WaveElevC0(2,J-K), SiKi ) / InitInp%NStepWave2
+ aWaveElevC1 = CMPLX( InitInp%WaveField%WaveElevC0(1, K), InitInp%WaveField%WaveElevC0(2, K), SiKi ) / InitInp%WaveField%NStepWave2
+ aWaveElevC2 = CMPLX( InitInp%WaveField%WaveElevC0(1,J-K), InitInp%WaveField%WaveElevC0(2,J-K), SiKi ) / InitInp%WaveField%NStepWave2
! Set the (omega1,omega2,beta1,beta2) point we are looking for.
- Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega2,SiKi), InitInp%WaveDirArr(K), InitInp%WaveDirArr(J-K) /)
+ Coord4 = (/ REAL(Omega1,SiKi), REAL(Omega2,SiKi), InitInp%WaveField%WaveDirArr(K), InitInp%WaveField%WaveDirArr(J-K) /)
! Apply local Z rotation to heading angle (degrees) to put wave direction into the local (rotated) body frame
Coord4(3) = Coord4(3) - RotateZdegOffset
@@ -2903,10 +2898,10 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
! of above is mathematically equivalent, but only because each frequency has only one wave
! direction associated with it through the equal energy approach used in multidirectional waves.
- WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- WaveNmbr2 = WaveNumber ( REAL(Omega2,SiKi), InitInp%Gravity, InitInp%WtrDpth ) ! SiKi returned
- TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(K)*D2R) )
- TmpReal2 = WaveNmbr2 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveDirArr(J-K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveDirArr(J-K)*D2R) )
+ WaveNmbr1 = WaveNumber ( REAL(Omega1,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ WaveNmbr2 = WaveNumber ( REAL(Omega2,SiKi), InitInp%Gravity, InitInp%WaveField%EffWtrDpth ) ! SiKi returned
+ TmpReal1 = WaveNmbr1 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(K)*D2R) )
+ TmpReal2 = WaveNmbr2 * ( InitInp%PtfmRefxt(1)*cos(InitInp%WaveField%WaveDirArr(J-K)*D2R) + InitInp%PtfmRefyt(1)*sin(InitInp%WaveField%WaveDirArr(J-K)*D2R) )
! Set the phase shift for the set of sum frequencies
PhaseShiftXY = CMPLX( cos(TmpReal1 + TmpReal2), -sin(TmpReal1 + TmpReal2) )
@@ -2940,7 +2935,7 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
RotateZMatrixT(:,2) = (/ sin(InitInp%PtfmRefztRot(IBody)), cos(InitInp%PtfmRefztRot(IBody)) /)
! Loop through all the frequencies
- DO J=1,InitInp%NStepWave2
+ DO J=1,InitInp%WaveField%NStepWave2
! Apply the rotation to get back to global frame -- term 1
Term1ArrayC(J,1:2) = MATMUL(RotateZMatrixT, Term1ArrayC(J,1:2))
@@ -2950,7 +2945,7 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
Term2ArrayC(J,1:2) = MATMUL(RotateZMatrixT, Term2ArrayC(J,1:2))
Term2ArrayC(J,4:5) = MATMUL(RotateZMatrixT, Term2ArrayC(J,4:5))
- ENDDO ! J=1,InitInp%NStepWave2
+ ENDDO ! J=1,InitInp%WaveField%NStepWave2
@@ -2980,12 +2975,12 @@ SUBROUTINE SumQTF_InitCalc( InitInp, p, SumQTFData, SumQTFForce, ErrMsg, ErrStat
ENDIF
! Now we add the two terms together. The 0.5 multiplier on is because the double sided FFT was used.
- DO J=0,InitInp%NStepWave-1 !bjj: Term1Array and Term2Array don't set the last element, so we can get over-flow errors here. SumQTFForce(InitInp%NStepWave,Idx) gets overwritten later, so Idx'm setting the array bounds to be -1.
+ DO J=0,InitInp%WaveField%NStepWave-1 !bjj: Term1Array and Term2Array don't set the last element, so we can get overflow errors here. SumQTFForce(InitInp%WaveField%NStepWave,Idx) gets overwritten later, so I'm setting the array bounds to be InitInp%WaveField%NStepWave-1.
SumQTFForce(J,Idx) = 0.5_SiKi*(REAL(Term1Array(J) + 2*Term2Array(J), SiKi))
ENDDO
! Copy the last first term to the first so that it is cyclic
- SumQTFForce(InitInp%NStepWave,Idx) = SumQTFForce(0,Idx)
+ SumQTFForce(InitInp%WaveField%NStepWave,Idx) = SumQTFForce(0,Idx)
ENDDO ! ThisDim -- current dimension
@@ -3196,39 +3191,6 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,
END IF
IF ( ErrStat >= AbortErrLev ) RETURN
-
- !--------------------------------------------------------------------------------
- !> ### Check the Min and Max frequencies for the full QTF cases
- !!
- !! -- these checks are performed based on the DiffQTFF and SumQTFF flags
- !--------------------------------------------------------------------------------
-
-
- !> 1. Check that the min / max diff frequencies make sense if using DiffQTF
-
- IF ( InitInp%DiffQTFF .eqv. .TRUE. ) THEN
- IF ( ( InitInp%WvHiCOffD < InitInp%WvLowCOffD ) .OR. ( InitInp%WvLowCOffD < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal, ' Programming Error in call to WAMIT2_Init: '//NewLine// &
- ' WvHiCOffD must be larger than WvLowCOffD. Both must be positive.'// &
- ' --> This should have been checked by the calling program.', ErrStat, ErrMsg, RoutineName)
- RETURN
- END IF
- END IF
-
-
- !> 2. Check that the min / max diff frequencies make sense if using SumQTF
-
- IF ( InitInp%SumQTFF .eqv. .TRUE. ) THEN
- IF ( ( InitInp%WvHiCOffS < InitInp%WvLowCOffS ) .OR. ( InitInp%WvLowCOffS < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal, ' Programming Error in call to WAMIT2_Init: '//NewLine// &
- ' WvHiCOffS must be larger than WvLowCOffS. Both must be positive.'// &
- ' --> This should have been checked by the calling program.', ErrStat, ErrMsg, RoutineName)
- RETURN
- END IF
- END IF
-
-
-
!--------------------------------------------------------------------------------
!> ### Assemble the names of the WAMIT data files we are using and verify existence
!--------------------------------------------------------------------------------
@@ -3319,11 +3281,11 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,
!> 1. Check that WaveElevC0 is a 2x(NStepWave2+1) sized array (0 index start)
- IF ( SIZE( InitInp%WaveElevC0, 2 ) /= (InitInp%NStepWave2 + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
+ IF ( SIZE( InitInp%WaveField%WaveElevC0, 2 ) /= (InitInp%WaveField%NStepWave2 + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
CALL SetErrStat( ErrID_Fatal, ' Programming error in call to WAMIT2_Init:'//NewLine// &
- ' --> Expected array for WaveElevC0 to be of size 2x'//TRIM(Num2LStr(InitInp%NStepWave2 + 1))// &
+ ' --> Expected array for WaveElevC0 to be of size 2x'//TRIM(Num2LStr(InitInp%WaveField%NStepWave2 + 1))// &
' (2x(NStepWave2+1)), but instead received array of size '// &
- TRIM(Num2LStr(SIZE(InitInp%WaveElevC0,1)))//'x'//TRIM(Num2LStr(SIZE(InitInp%WaveElevC0,2)))//'.', ErrStat, ErrMsg, RoutineName)
+ TRIM(Num2LStr(SIZE(InitInp%WaveField%WaveElevC0,1)))//'x'//TRIM(Num2LStr(SIZE(InitInp%WaveField%WaveElevC0,2)))//'.', ErrStat, ErrMsg, RoutineName)
RETURN
END IF
@@ -3333,13 +3295,9 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,
!--------------------------------------------------------------------------------
!> ### Now copy over things to parameters...
!--------------------------------------------------------------------------------
- !> 1. Wave information we need to keep
- !--------------------------------------------------------------------------------
- p%NStepWave = InitInp%NStepWave
-
!--------------------------------------------------------------------------------
- !> 3. WAMIT body related information
+ !> WAMIT body related information
!--------------------------------------------------------------------------------
p%NBody = InitInp%NBody ! Number of bodies WAMIT2 sees
@@ -3456,7 +3414,7 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,
!--------------------------------------------------------------------------------
! Allocate array for the WaveExtcn2.
- ALLOCATE( p%WaveExctn2(0:InitInp%NStepWave,6*p%NBody), STAT=ErrStatTmp)
+ ALLOCATE( p%WaveExctn2(0:InitInp%WaveField%NStepWave,6*p%NBody), STAT=ErrStatTmp)
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array p%WaveExctn2 to store '// &
'the 2nd order force data.', ErrStat,ErrMsg,'CheckInitInp')
IF (ErrStat >= AbortErrLev ) RETURN
@@ -3996,9 +3954,9 @@ SUBROUTINE Read_DataFile3D( InitInp, Filename3D, Data3D, ErrStat, Errmsg )
IF ( Data3D%DataMask( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4) ) ) THEN
IF ( .NOT. EqualRealNos(REAL(Data3D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4) ),SiKi), &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K * RawData3D(I,7) ,SiKi)) .AND. &
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K * RawData3D(I,7) ,SiKi)) .AND. &
.NOT. EqualRealNos( AIMAG(Data3D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4) ) ), &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K * RawData3D(I,8) ,SiKi)) ) THEN
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K * RawData3D(I,8) ,SiKi)) ) THEN
CALL SetErrStat( ErrID_Fatal, ' Line '//TRIM(Num2Lstr(NumHeaderLines+I))//' of '//TRIM(Filename3D)// &
' contains different values for the real and imaginary part (columns 7 and 8) than was '// &
'given earlier in the file for the same values of wave frequency and wave direction '// &
@@ -4011,7 +3969,7 @@ SUBROUTINE Read_DataFile3D( InitInp, Filename3D, Data3D, ErrStat, Errmsg )
! Store the data after dimensionalizing
Data3D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4) ) = &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K,SiKi) * CMPLX(RawData3D(I,7),RawData3D(I,8),SiKi)
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K,SiKi) * CMPLX(RawData3D(I,7),RawData3D(I,8),SiKi)
! Set flag indicating that this value has been inserted.
Data3D%DataMask( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4) ) = .TRUE.
@@ -4760,9 +4718,9 @@ SUBROUTINE Read_DataFile4D( InitInp, Filename4D, Data4D, ErrStat, Errmsg )
IF ( Data4D%DataMask( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4), TmpCoord(5) ) ) THEN
IF ( .NOT. EqualRealNos( REAL(Data4D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4), TmpCoord(5) ),SiKi), &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K * RawData4D(I,8) ,SiKi)) .AND. &
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K * RawData4D(I,8) ,SiKi)) .AND. &
.NOT. EqualRealNos(AIMAG(Data4D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4), TmpCoord(5) )), &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K * RawData4D(I,9) ,SiKi))) THEN
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K * RawData4D(I,9) ,SiKi))) THEN
CALL SetErrStat( ErrID_Fatal, ' Line '//TRIM(Num2Lstr(NumHeaderLines+I))//' of '//TRIM(Filename4D)// &
' contains different values for the real and imaginary part (columns 8 and 9) than was '// &
'given earlier in the file for the same values of wave frequency and wave direction '// &
@@ -4775,7 +4733,7 @@ SUBROUTINE Read_DataFile4D( InitInp, Filename4D, Data4D, ErrStat, Errmsg )
! Store the data after dimensionalizing
Data4D%DataSet( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4), TmpCoord(5) ) = &
- REAL(InitInp%RhoXg * InitInp%WAMITULEN**K,SiKi) * CMPLX(RawData4D(I,8),RawData4D(I,9),SiKi)
+ REAL(InitInp%WaveField%RhoXg * InitInp%WAMITULEN**K,SiKi) * CMPLX(RawData4D(I,8),RawData4D(I,9),SiKi)
! Set flag indicating that this value has been inserted.
Data4D%DataMask( TmpCoord(1), TmpCoord(2), TmpCoord(3), TmpCoord(4), TmpCoord(5) ) = .TRUE.
@@ -5397,11 +5355,11 @@ END SUBROUTINE ReadRealNumber
!----------------------------------------------------------------------------------------------------------------------------------
!> Routine for computing outputs, used in both loose and tight coupling.
-SUBROUTINE WAMIT2_CalcOutput( Time, WaveTime, p, y, m, ErrStat, ErrMsg )
+SUBROUTINE WAMIT2_CalcOutput( Time, WaveField, p, y, m, ErrStat, ErrMsg )
!..................................................................................................................................
REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds
- real(SiKi), intent(in ) :: WaveTime(:) !< Array of wave kinematic time samples, (sec)
+ TYPE(SeaSt_WaveFieldType), INTENT(IN ) :: WaveField !< Wave data
TYPE(WAMIT2_ParameterType), INTENT(IN ) :: p !< Parameters
TYPE(WAMIT2_OutputType), INTENT(INOUT) :: y !< Outputs computed at Time (Input only so that mesh
!! connectivity information does not have to be recalculated)
@@ -5423,28 +5381,17 @@ SUBROUTINE WAMIT2_CalcOutput( Time, WaveTime, p, y, m, ErrStat, ErrMsg )
ErrMsg = ""
-
-
- ! Abort if the wave excitation loads have not been computed yet:
-
- IF ( .NOT. ALLOCATED ( p%WaveExctn2 ) ) THEN
- CALL SetErrStat(ErrID_Fatal,' Routine WAMIT2_Init() must be called before routine WAMIT2_CalcOutput().',ErrStat,ErrMsg,'WAMIT2_CalcOutput')
- RETURN
- END IF
-
-
! Compute the 2nd order load contribution from incident waves:
do iBody = 1, p%NBody
indxStart = (iBody-1)*6
DO I = 1,6 ! Loop through all wave excitation forces and moments
- m%F_Waves2(indxStart+I) = InterpWrappedStpReal ( REAL(Time, SiKi), WaveTime(:), p%WaveExctn2(:,indxStart+I), &
- m%LastIndWave(IBody), p%NStepWave + 1 )
+ m%F_Waves2(indxStart+I) = InterpWrappedStpReal ( REAL(Time, SiKi), WaveField%WaveTime, p%WaveExctn2(:,indxStart+I), &
+ m%LastIndWave(IBody), WaveField%NStepWave + 1 )
END DO ! I - All wave excitation forces and moments
-
! Copy results to the output point mesh
DO I=1,3
y%Mesh%Force(I,IBody) = m%F_Waves2(indxStart+I)
diff --git a/modules/hydrodyn/src/WAMIT2.txt b/modules/hydrodyn/src/WAMIT2.txt
index 79ff8a8b33..4461144d7e 100644
--- a/modules/hydrodyn/src/WAMIT2.txt
+++ b/modules/hydrodyn/src/WAMIT2.txt
@@ -13,6 +13,7 @@
# ...... Include files (definitions from NWTC Library) ............................................................................
# make sure that the file name does not have any trailing white spaces!
include Registry_NWTC_Library.txt
+usefrom SeaSt_WaveField.txt
param WAMIT2/WAMIT2 unused INTEGER MaxWAMIT2Outputs - 6 - "" -
@@ -27,22 +28,9 @@ typedef ^ ^ ReKi PtfmRefzt
typedef ^ ^ R8Ki PtfmRefztRot {:} - - "The rotation about zt of the body reference frame(s) from xt/yt" radians
typedef ^ ^ ReKi WAMITULEN - - - "WAMIT unit length scale" -
-typedef ^ ^ ReKi RhoXg - - - "Density * Gravity -- from the Waves module." -
-typedef ^ ^ INTEGER NStepWave - - - "Total number of frequency components = total number of time steps in the incident wave" -
-typedef ^ ^ INTEGER NStepWave2 - - - "NStepWave / 2" -
-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 ^ ^ 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 (points to SeaState module data)" (meters)
-typedef ^ ^ SiKi WaveDir - - - "Mean incident wave propagation heading direction" (degrees)
-typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
-typedef ^ ^ SiKi WaveDirArr {*} - - "Wave direction assigned to each frequency (points to SeaState module data)" (degrees)
-typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction from Waves module" -
-typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction from Waves module" -
-
-typedef ^ ^ INTEGER WaveMod - - - "The wave model to use. This is for error checking -- ideally this would be done in the main calling routine, not here." -
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
#[note: only one of MnDriff / NewmanApp / DiffQTF can be non-zero
typedef ^ ^ INTEGER MnDrift - - - "Calculate the mean drift force {0: no mean drift; [7,8,9,10,11, or 12]: WAMIT file to use}" -
@@ -53,12 +41,6 @@ typedef ^ ^ LOGICAL MnDriftF
typedef ^ ^ LOGICAL NewmanAppF - - - "Flag indicating Newman approximation should be calculated" -
typedef ^ ^ LOGICAL DiffQTFF - - - "Flag indicating the full difference QTF should be calculated" -
typedef ^ ^ LOGICAL SumQTFF - - - "Flag indicating the full sum QTF should be calculated" -
-typedef ^ ^ ReKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ ReKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ ReKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ ReKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ ReKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ ReKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
@@ -75,8 +57,7 @@ typedef ^ ^ ReKi F_Waves2
# Define parameters here:
# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states:
#
-typedef ^ ParameterType IntKi NStepWave - - - "Number of wave time steps" -
-typedef ^ ^ 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 ^ ParameterType 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]" -
#The 2nd order force time series
diff --git a/modules/hydrodyn/src/WAMIT2_Types.f90 b/modules/hydrodyn/src/WAMIT2_Types.f90
index b29c74410f..603be0c1d1 100644
--- a/modules/hydrodyn/src/WAMIT2_Types.f90
+++ b/modules/hydrodyn/src/WAMIT2_Types.f90
@@ -31,6 +31,7 @@
!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry.
MODULE WAMIT2_Types
!---------------------------------------------------------------------------------------------------------------------------------
+USE SeaSt_WaveField_Types
USE NWTC_Library
IMPLICIT NONE
INTEGER(IntKi), PUBLIC, PARAMETER :: MaxWAMIT2Outputs = 6 ! [-]
@@ -45,20 +46,8 @@ MODULE WAMIT2_Types
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: PtfmRefzt !< The zt offset of the body reference point(s) from (0,0,0) [1 to NBody; only used when PotMod=1; must be 0.0 if NBodyMod=2 ] [(m)]
REAL(R8Ki) , DIMENSION(:), ALLOCATABLE :: PtfmRefztRot !< The rotation about zt of the body reference frame(s) from xt/yt [radians]
REAL(ReKi) :: WAMITULEN = 0.0_ReKi !< WAMIT unit length scale [-]
- REAL(ReKi) :: RhoXg = 0.0_ReKi !< Density * Gravity -- from the Waves module. [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Total number of frequency components = total number of time steps in the incident wave [-]
- INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< NStepWave / 2 [-]
- REAL(ReKi) :: WaveDOmega = 0.0_ReKi !< Frequency step for incident wave calculations [(rad/s)]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density [(kg/m^3)]
REAL(ReKi) :: Gravity = 0.0_ReKi !< Supplied by Driver: Gravitational acceleration [(m/s^2)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< 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 (points to SeaState module data) [(meters)]
- REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Mean incident wave propagation heading direction [(degrees)]
- LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Wave direction assigned to each frequency (points to SeaState module data) [(degrees)]
- REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction from Waves module [-]
- REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction from Waves module [-]
- INTEGER(IntKi) :: WaveMod = 0_IntKi !< The wave model to use. This is for error checking -- ideally this would be done in the main calling routine, not here. [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to wave field [-]
INTEGER(IntKi) :: MnDrift = 0_IntKi !< Calculate the mean drift force {0: no mean drift; [7,8,9,10,11, or 12]: WAMIT file to use} [-]
INTEGER(IntKi) :: NewmanApp = 0_IntKi !< Slow drift forces computed with Newman approximation from WAMIT file:{0: No slow drift; [7,8,9,10,11, or 12]: WAMIT file to use} [-]
INTEGER(IntKi) :: DiffQTF = 0_IntKi !< Full Difference-Frequency forces computed with full QTF's from WAMIT file: {0: No diff-QTF; [10,11, or 12]: WAMIT file to use} [-]
@@ -67,12 +56,6 @@ MODULE WAMIT2_Types
LOGICAL :: NewmanAppF = .false. !< Flag indicating Newman approximation should be calculated [-]
LOGICAL :: DiffQTFF = .false. !< Flag indicating the full difference QTF should be calculated [-]
LOGICAL :: SumQTFF = .false. !< Flag indicating the full sum QTF should be calculated [-]
- REAL(ReKi) :: WvLowCOff = 0.0_ReKi !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(ReKi) :: WvHiCOff = 0.0_ReKi !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(ReKi) :: WvLowCOffD = 0.0_ReKi !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(ReKi) :: WvHiCOffD = 0.0_ReKi !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(ReKi) :: WvLowCOffS = 0.0_ReKi !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
- REAL(ReKi) :: WvHiCOffS = 0.0_ReKi !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
END TYPE WAMIT2_InitInputType
! =======================
! ========= WAMIT2_MiscVarType =======
@@ -83,7 +66,6 @@ MODULE WAMIT2_Types
! =======================
! ========= WAMIT2_ParameterType =======
TYPE, PUBLIC :: WAMIT2_ParameterType
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Number of wave time steps [-]
INTEGER(IntKi) :: NBody = 0_IntKi !< [>=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 = 0_IntKi !< 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(SiKi) , DIMENSION(:,:), ALLOCATABLE :: WaveExctn2 !< Time series of the resulting 2nd order force (first index is timestep, second index is load component) [(N)]
@@ -110,8 +92,9 @@ subroutine WAMIT2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(2), UB(2)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
+ character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'WAMIT2_CopyInitInput'
ErrStat = ErrID_None
ErrMsg = ''
@@ -168,20 +151,8 @@ subroutine WAMIT2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
DstInitInputData%PtfmRefztRot = SrcInitInputData%PtfmRefztRot
end if
DstInitInputData%WAMITULEN = SrcInitInputData%WAMITULEN
- DstInitInputData%RhoXg = SrcInitInputData%RhoXg
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
- DstInitInputData%NStepWave2 = SrcInitInputData%NStepWave2
- DstInitInputData%WaveDOmega = SrcInitInputData%WaveDOmega
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
DstInitInputData%Gravity = SrcInitInputData%Gravity
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
- DstInitInputData%WaveElevC0 => SrcInitInputData%WaveElevC0
- DstInitInputData%WaveDir = SrcInitInputData%WaveDir
- DstInitInputData%WaveMultiDir = SrcInitInputData%WaveMultiDir
- DstInitInputData%WaveDirArr => SrcInitInputData%WaveDirArr
- DstInitInputData%WaveDirMin = SrcInitInputData%WaveDirMin
- DstInitInputData%WaveDirMax = SrcInitInputData%WaveDirMax
- DstInitInputData%WaveMod = SrcInitInputData%WaveMod
+ DstInitInputData%WaveField => SrcInitInputData%WaveField
DstInitInputData%MnDrift = SrcInitInputData%MnDrift
DstInitInputData%NewmanApp = SrcInitInputData%NewmanApp
DstInitInputData%DiffQTF = SrcInitInputData%DiffQTF
@@ -190,18 +161,14 @@ subroutine WAMIT2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
DstInitInputData%NewmanAppF = SrcInitInputData%NewmanAppF
DstInitInputData%DiffQTFF = SrcInitInputData%DiffQTFF
DstInitInputData%SumQTFF = SrcInitInputData%SumQTFF
- DstInitInputData%WvLowCOff = SrcInitInputData%WvLowCOff
- DstInitInputData%WvHiCOff = SrcInitInputData%WvHiCOff
- DstInitInputData%WvLowCOffD = SrcInitInputData%WvLowCOffD
- DstInitInputData%WvHiCOffD = SrcInitInputData%WvHiCOffD
- DstInitInputData%WvLowCOffS = SrcInitInputData%WvLowCOffS
- DstInitInputData%WvHiCOffS = SrcInitInputData%WvHiCOffS
end subroutine
subroutine WAMIT2_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
type(WAMIT2_InitInputType), intent(inout) :: InitInputData
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
+ integer(IntKi) :: ErrStat2
+ character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'WAMIT2_DestroyInitInput'
ErrStat = ErrID_None
ErrMsg = ''
@@ -217,8 +184,7 @@ subroutine WAMIT2_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
if (allocated(InitInputData%PtfmRefztRot)) then
deallocate(InitInputData%PtfmRefztRot)
end if
- nullify(InitInputData%WaveElevC0)
- nullify(InitInputData%WaveDirArr)
+ nullify(InitInputData%WaveField)
end subroutine
subroutine WAMIT2_PackInitInput(Buf, Indata)
@@ -252,34 +218,14 @@ subroutine WAMIT2_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%PtfmRefztRot)
end if
call RegPack(Buf, InData%WAMITULEN)
- call RegPack(Buf, InData%RhoXg)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, InData%WtrDens)
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, InData%WaveDir)
- call RegPack(Buf, InData%WaveMultiDir)
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
end if
end if
- call RegPack(Buf, InData%WaveDirMin)
- call RegPack(Buf, InData%WaveDirMax)
- call RegPack(Buf, InData%WaveMod)
call RegPack(Buf, InData%MnDrift)
call RegPack(Buf, InData%NewmanApp)
call RegPack(Buf, InData%DiffQTF)
@@ -288,12 +234,6 @@ subroutine WAMIT2_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%NewmanAppF)
call RegPack(Buf, InData%DiffQTFF)
call RegPack(Buf, InData%SumQTFF)
- call RegPack(Buf, InData%WvLowCOff)
- call RegPack(Buf, InData%WvHiCOff)
- call RegPack(Buf, InData%WvLowCOffD)
- call RegPack(Buf, InData%WvHiCOffD)
- call RegPack(Buf, InData%WvLowCOffS)
- call RegPack(Buf, InData%WvHiCOffS)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -301,7 +241,7 @@ subroutine WAMIT2_UnPackInitInput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(WAMIT2_InitInputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'WAMIT2_UnPackInitInput'
- integer(IntKi) :: LB(2), UB(2)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -373,78 +313,28 @@ subroutine WAMIT2_UnPackInitInput(Buf, OutData)
end if
call RegUnpack(Buf, OutData%WAMITULEN)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%RhoXg)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpackPointer(Buf, Ptr, PtrIdx)
if (RegCheckErr(Buf, RoutineName)) return
if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
+ call c_f_pointer(Ptr, OutData%WaveField)
else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
+ allocate(OutData%WaveField,stat=stat)
if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
return
end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
end if
else
- OutData%WaveElevC0 => null()
+ OutData%WaveField => null()
end if
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMultiDir)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
- else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDirArr => null()
- end if
- call RegUnpack(Buf, OutData%WaveDirMin)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMax)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMod)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%MnDrift)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NewmanApp)
@@ -461,18 +351,6 @@ subroutine WAMIT2_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%SumQTFF)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
end subroutine
subroutine WAMIT2_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg)
@@ -594,7 +472,6 @@ subroutine WAMIT2_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMs
character(*), parameter :: RoutineName = 'WAMIT2_CopyParam'
ErrStat = ErrID_None
ErrMsg = ''
- DstParamData%NStepWave = SrcParamData%NStepWave
DstParamData%NBody = SrcParamData%NBody
DstParamData%NBodyMod = SrcParamData%NBodyMod
if (allocated(SrcParamData%WaveExctn2)) then
@@ -636,7 +513,6 @@ subroutine WAMIT2_PackParam(Buf, Indata)
type(WAMIT2_ParameterType), intent(in) :: InData
character(*), parameter :: RoutineName = 'WAMIT2_PackParam'
if (Buf%ErrStat >= AbortErrLev) return
- call RegPack(Buf, InData%NStepWave)
call RegPack(Buf, InData%NBody)
call RegPack(Buf, InData%NBodyMod)
call RegPack(Buf, allocated(InData%WaveExctn2))
@@ -663,8 +539,6 @@ subroutine WAMIT2_UnPackParam(Buf, OutData)
integer(IntKi) :: stat
logical :: IsAllocAssoc
if (Buf%ErrStat /= ErrID_None) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NBody)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NBodyMod)
diff --git a/modules/hydrodyn/src/WAMIT_Types.f90 b/modules/hydrodyn/src/WAMIT_Types.f90
index f09135bcc5..5ec3700014 100644
--- a/modules/hydrodyn/src/WAMIT_Types.f90
+++ b/modules/hydrodyn/src/WAMIT_Types.f90
@@ -41,7 +41,6 @@ MODULE WAMIT_Types
INTEGER(IntKi) :: NBody = 0_IntKi !< [>=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 = 0_IntKi !< 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 = 0.0_ReKi !< Supplied by Driver: Gravitational acceleration [(m/s^2)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth (positive-valued) [m]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: PtfmVol0 !< [-]
LOGICAL :: HasWAMIT = .false. !< .TRUE. if using WAMIT model, .FALSE. otherwise [-]
REAL(ReKi) :: WAMITULEN = 0.0_ReKi !< [-]
@@ -56,24 +55,9 @@ MODULE WAMIT_Types
INTEGER(IntKi) :: ExctnDisp = 0_IntKi !< 0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0] [-]
REAL(ReKi) :: ExctnCutOff = 0.0_ReKi !< Cutoff (corner) frequency of the low-pass time-filtered displaced position (Hz) [>0.0] [Hz]
REAL(DbKi) :: RdtnTMax = 0.0_R8Ki !< [-]
- REAL(ReKi) :: WaveDir = 0.0_ReKi !< [-]
CHARACTER(1024) :: WAMITFile !< [-]
TYPE(Conv_Rdtn_InitInputType) :: Conv_Rdtn !< [-]
- REAL(ReKi) :: Rhoxg = 0.0_ReKi !< [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< [-]
- INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< [-]
- REAL(ReKi) :: WaveDOmega = 0.0_ReKi !< [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveElev0 => NULL() !< Wave elevation time history at origin (needed for SS_Excitation module) [m]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev1 => NULL() !< First order wave elevation (points to SeaState module data) [-]
- 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 (points to SeaState module data) [(meters)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElevC => NULL() !< Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part [(meters)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< (points to SeaState module data) [-]
- INTEGER(IntKi) :: WaveMod = 0_IntKi !< [-]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Array of wave directions (one per frequency) from the Waves module (points to SeaState module data) [-]
- REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction from Waves module [-]
- REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction from Waves module [-]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to wave field [-]
END TYPE WAMIT_InitInputType
! =======================
! ========= WAMIT_ContinuousStateType =======
@@ -138,12 +122,11 @@ MODULE WAMIT_Types
REAL(ReKi) :: ExctnFiltConst = 0.0_ReKi !< Low-pass time filter constant computed from ExctnCutOff [-]
REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: WaveExctn !< [-]
REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: WaveExctnGrid !< WaveExctnGrid dimensions are: 1st: wavetime, 2nd: X, 3rd: Y, 4th: Force component for eac WAMIT Body [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< [-]
TYPE(Conv_Rdtn_ParameterType) :: Conv_Rdtn !< [-]
TYPE(SS_Rad_ParameterType) :: SS_Rdtn !< [-]
TYPE(SS_Exc_ParameterType) :: SS_Exctn !< [-]
REAL(DbKi) :: DT = 0.0_R8Ki !< [-]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
+ TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to wave field [-]
END TYPE WAMIT_ParameterType
! =======================
! ========= WAMIT_InputType =======
@@ -164,7 +147,7 @@ subroutine WAMIT_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Err
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'WAMIT_CopyInitInput'
@@ -173,7 +156,6 @@ subroutine WAMIT_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Err
DstInitInputData%NBody = SrcInitInputData%NBody
DstInitInputData%NBodyMod = SrcInitInputData%NBodyMod
DstInitInputData%Gravity = SrcInitInputData%Gravity
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
if (allocated(SrcInitInputData%PtfmVol0)) then
LB(1:1) = lbound(SrcInitInputData%PtfmVol0)
UB(1:1) = ubound(SrcInitInputData%PtfmVol0)
@@ -265,28 +247,11 @@ subroutine WAMIT_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Err
DstInitInputData%ExctnDisp = SrcInitInputData%ExctnDisp
DstInitInputData%ExctnCutOff = SrcInitInputData%ExctnCutOff
DstInitInputData%RdtnTMax = SrcInitInputData%RdtnTMax
- DstInitInputData%WaveDir = SrcInitInputData%WaveDir
DstInitInputData%WAMITFile = SrcInitInputData%WAMITFile
call Conv_Rdtn_CopyInitInput(SrcInitInputData%Conv_Rdtn, DstInitInputData%Conv_Rdtn, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
- DstInitInputData%Rhoxg = SrcInitInputData%Rhoxg
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
- DstInitInputData%NStepWave2 = SrcInitInputData%NStepWave2
- DstInitInputData%WaveDOmega = SrcInitInputData%WaveDOmega
- DstInitInputData%WaveElev0 => SrcInitInputData%WaveElev0
- DstInitInputData%WaveElev1 => SrcInitInputData%WaveElev1
- DstInitInputData%WaveElevC0 => SrcInitInputData%WaveElevC0
- DstInitInputData%WaveElevC => SrcInitInputData%WaveElevC
- DstInitInputData%WaveTime => SrcInitInputData%WaveTime
- DstInitInputData%WaveMod = SrcInitInputData%WaveMod
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
- DstInitInputData%WaveDirArr => SrcInitInputData%WaveDirArr
- DstInitInputData%WaveDirMin = SrcInitInputData%WaveDirMin
- DstInitInputData%WaveDirMax = SrcInitInputData%WaveDirMax
- call SeaSt_Interp_CopyParam(SrcInitInputData%SeaSt_Interp_p, DstInitInputData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
+ DstInitInputData%WaveField => SrcInitInputData%WaveField
end subroutine
subroutine WAMIT_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
@@ -321,14 +286,7 @@ subroutine WAMIT_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
end if
call Conv_Rdtn_DestroyInitInput(InitInputData%Conv_Rdtn, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- nullify(InitInputData%WaveElev0)
- nullify(InitInputData%WaveElev1)
- nullify(InitInputData%WaveElevC0)
- nullify(InitInputData%WaveElevC)
- nullify(InitInputData%WaveTime)
- nullify(InitInputData%WaveDirArr)
- call SeaSt_Interp_DestroyParam(InitInputData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
+ nullify(InitInputData%WaveField)
end subroutine
subroutine WAMIT_PackInitInput(Buf, Indata)
@@ -340,7 +298,6 @@ subroutine WAMIT_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%NBody)
call RegPack(Buf, InData%NBodyMod)
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDpth)
call RegPack(Buf, allocated(InData%PtfmVol0))
if (allocated(InData%PtfmVol0)) then
call RegPackBounds(Buf, 1, lbound(InData%PtfmVol0), ubound(InData%PtfmVol0))
@@ -383,66 +340,15 @@ subroutine WAMIT_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%ExctnDisp)
call RegPack(Buf, InData%ExctnCutOff)
call RegPack(Buf, InData%RdtnTMax)
- call RegPack(Buf, InData%WaveDir)
call RegPack(Buf, InData%WAMITFile)
call Conv_Rdtn_PackInitInput(Buf, InData%Conv_Rdtn)
- call RegPack(Buf, InData%Rhoxg)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, associated(InData%WaveElev0))
- if (associated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPackPointer(Buf, c_loc(InData%WaveElev0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev1))
- if (associated(InData%WaveElev1)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev1), ubound(InData%WaveElev1))
- call RegPackPointer(Buf, c_loc(InData%WaveElev1), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev1)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElevC))
- if (associated(InData%WaveElevC)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElevC), ubound(InData%WaveElevC))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
end if
end if
- call RegPack(Buf, InData%WaveMod)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
- end if
- end if
- call RegPack(Buf, InData%WaveDirMin)
- call RegPack(Buf, InData%WaveDirMax)
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -450,7 +356,7 @@ subroutine WAMIT_UnPackInitInput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(WAMIT_InitInputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'WAMIT_UnPackInitInput'
- integer(IntKi) :: LB(3), UB(3)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -462,8 +368,6 @@ subroutine WAMIT_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%PtfmVol0)) deallocate(OutData%PtfmVol0)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -576,172 +480,29 @@ subroutine WAMIT_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%RdtnTMax)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WAMITFile)
if (RegCheckErr(Buf, RoutineName)) return
call Conv_Rdtn_UnpackInitInput(Buf, OutData%Conv_Rdtn) ! Conv_Rdtn
- call RegUnpack(Buf, OutData%Rhoxg)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev0, UB(1:1)-LB(1:1))
- OutData%WaveElev0(LB(1):) => OutData%WaveElev0
- else
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev0)
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev0 => null()
- end if
- if (associated(OutData%WaveElev1)) deallocate(OutData%WaveElev1)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev1, UB(1:3)-LB(1:3))
- OutData%WaveElev1(LB(1):,LB(2):,LB(3):) => OutData%WaveElev1
- else
- allocate(OutData%WaveElev1(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev1.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev1)
- call RegUnpack(Buf, OutData%WaveElev1)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev1 => null()
- end if
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
- else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC0 => null()
- end if
- if (associated(OutData%WaveElevC)) deallocate(OutData%WaveElevC)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC, UB(1:3)-LB(1:3))
- OutData%WaveElevC(LB(1):,LB(2):,LB(3):) => OutData%WaveElevC
- else
- allocate(OutData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC)
- call RegUnpack(Buf, OutData%WaveElevC)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC => null()
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
- call RegUnpack(Buf, OutData%WaveMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpackPointer(Buf, Ptr, PtrIdx)
if (RegCheckErr(Buf, RoutineName)) return
if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
+ call c_f_pointer(Ptr, OutData%WaveField)
else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
+ allocate(OutData%WaveField,stat=stat)
if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
return
end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
end if
else
- OutData%WaveDirArr => null()
+ OutData%WaveField => null()
end if
- call RegUnpack(Buf, OutData%WaveDirMin)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMax)
- if (RegCheckErr(Buf, RoutineName)) return
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
end subroutine
subroutine WAMIT_CopyContState(SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg)
@@ -1354,7 +1115,6 @@ subroutine WAMIT_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
end if
DstParamData%WaveExctnGrid = SrcParamData%WaveExctnGrid
end if
- DstParamData%NStepWave = SrcParamData%NStepWave
call Conv_Rdtn_CopyParam(SrcParamData%Conv_Rdtn, DstParamData%Conv_Rdtn, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
@@ -1365,9 +1125,7 @@ subroutine WAMIT_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
DstParamData%DT = SrcParamData%DT
- call SeaSt_Interp_CopyParam(SrcParamData%SeaSt_Interp_p, DstParamData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
+ DstParamData%WaveField => SrcParamData%WaveField
end subroutine
subroutine WAMIT_DestroyParam(ParamData, ErrStat, ErrMsg)
@@ -1400,14 +1158,14 @@ subroutine WAMIT_DestroyParam(ParamData, ErrStat, ErrMsg)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call SS_Exc_DestroyParam(ParamData%SS_Exctn, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- call SeaSt_Interp_DestroyParam(ParamData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
+ nullify(ParamData%WaveField)
end subroutine
subroutine WAMIT_PackParam(Buf, Indata)
type(PackBuffer), intent(inout) :: Buf
type(WAMIT_ParameterType), intent(in) :: InData
character(*), parameter :: RoutineName = 'WAMIT_PackParam'
+ logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, InData%NBody)
call RegPack(Buf, InData%NBodyMod)
@@ -1441,12 +1199,17 @@ subroutine WAMIT_PackParam(Buf, Indata)
call RegPackBounds(Buf, 4, lbound(InData%WaveExctnGrid), ubound(InData%WaveExctnGrid))
call RegPack(Buf, InData%WaveExctnGrid)
end if
- call RegPack(Buf, InData%NStepWave)
call Conv_Rdtn_PackParam(Buf, InData%Conv_Rdtn)
call SS_Rad_PackParam(Buf, InData%SS_Rdtn)
call SS_Exc_PackParam(Buf, InData%SS_Exctn)
call RegPack(Buf, InData%DT)
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
+ call RegPack(Buf, associated(InData%WaveField))
+ if (associated(InData%WaveField)) then
+ call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
+ if (.not. PtrInIndex) then
+ call SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, InData%WaveField)
+ end if
+ end if
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -1457,6 +1220,8 @@ subroutine WAMIT_UnPackParam(Buf, OutData)
integer(IntKi) :: LB(4), UB(4)
integer(IntKi) :: stat
logical :: IsAllocAssoc
+ integer(IntKi) :: PtrIdx
+ type(c_ptr) :: Ptr
if (Buf%ErrStat /= ErrID_None) return
call RegUnpack(Buf, OutData%NBody)
if (RegCheckErr(Buf, RoutineName)) return
@@ -1542,14 +1307,31 @@ subroutine WAMIT_UnPackParam(Buf, OutData)
call RegUnpack(Buf, OutData%WaveExctnGrid)
if (RegCheckErr(Buf, RoutineName)) return
end if
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
call Conv_Rdtn_UnpackParam(Buf, OutData%Conv_Rdtn) ! Conv_Rdtn
call SS_Rad_UnpackParam(Buf, OutData%SS_Rdtn) ! SS_Rdtn
call SS_Exc_UnpackParam(Buf, OutData%SS_Exctn) ! SS_Exctn
call RegUnpack(Buf, OutData%DT)
if (RegCheckErr(Buf, RoutineName)) return
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
+ call RegUnpack(Buf, IsAllocAssoc)
+ if (RegCheckErr(Buf, RoutineName)) return
+ if (IsAllocAssoc) then
+ call RegUnpackPointer(Buf, Ptr, PtrIdx)
+ if (RegCheckErr(Buf, RoutineName)) return
+ if (c_associated(Ptr)) then
+ call c_f_pointer(Ptr, OutData%WaveField)
+ else
+ allocate(OutData%WaveField,stat=stat)
+ if (stat /= 0) then
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ return
+ end if
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
+ end if
+ else
+ OutData%WaveField => null()
+ end if
end subroutine
subroutine WAMIT_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg)
diff --git a/modules/nwtc-library/src/NWTC_RandomNumber.f90 b/modules/nwtc-library/src/NWTC_RandomNumber.f90
index f12b9a8528..52c4f0640c 100644
--- a/modules/nwtc-library/src/NWTC_RandomNumber.f90
+++ b/modules/nwtc-library/src/NWTC_RandomNumber.f90
@@ -46,8 +46,8 @@ SUBROUTINE RandNum_Init(p, ErrStat, ErrMsg )
IMPLICIT NONE
TYPE(NWTC_RandomNumber_ParameterType), INTENT(IN ) :: p ! PARAMETERs for random number generation
- INTEGER(IntKi) , INTENT(OUT) :: ErrStat ! allocation status
- CHARACTER(*) , INTENT(OUT) :: ErrMsg ! error message
+ INTEGER(IntKi) , INTENT(OUT) :: ErrStat ! allocation status
+ CHARACTER(*) , INTENT(OUT) :: ErrMsg ! error message
INTEGER :: I ! loop counter
INTEGER(IntKi), ALLOCATABLE :: NextSeed(:) ! The array that holds the next random seed for each component
diff --git a/modules/nwtc-library/src/ranlux/RANLUX.f90 b/modules/nwtc-library/src/ranlux/RANLUX.f90
index a9ae2063ff..e58830d546 100644
--- a/modules/nwtc-library/src/ranlux/RANLUX.f90
+++ b/modules/nwtc-library/src/ranlux/RANLUX.f90
@@ -36,9 +36,6 @@ Module Ran_Lux_Mod
! 1 1.5 2 3 5 on fast mainframe
!
! NotYet is .TRUE. if no initialization has been performed yet.
-!Start bjj: We want to write to the screen instead of "print *"
-! use NWTC_IO
-!End bjj:
use precision
implicit none
@@ -78,22 +75,12 @@ subroutine RanLux (RVec)
NotYet = .FALSE.
JSeed = JSDFlt
InSeed = JSeed
-!begin bjj
-! print *, " RanLux default initialization: ", JSeed
-! write( RanLux_str, '(I12)' ) JSeed
-! CALL WrScr( " RanLux default initialization: "//TRIM( ADJUSTL( RanLux_str ) ) )
-!end bjj
LuxLev = LxDflt
NSkip = NDSkip(LuxLev)
LP = NSkip + NSeeds - 1
In24 = 0
Kount = 0
MKount = 0
-!begin bjj
-! print *, " RanLux default luxury level = ", LuxLev, " p = ", LP
-! write( RanLux_str, '(A,I5,A,I12)' ) " RanLux default luxury level = ", LuxLev, " p = ", LP
-! CALL WrScr( TRIM( RanLux_str ) )
-!end bjj
TwoM24 = 1.0
do I = 1, NSeeds - 1
@@ -129,14 +116,8 @@ subroutine RanLux (RVec)
! "Pad" small numbers (with less than 12 "significant" bits) and eliminate zero values (in case someone takes a logarithm)
if ( RVec(IVec) < TwoM12 ) RVec(IVec) = RVec(IVec) + tmpTwoM24Seed
if ( Rvec(IVec) == 0.0 ) RVec(IVec) = tmpTwoM24
- !bjj end of modifications
end do
- !bjj removed to eliminate crashing in SNwind
- ! "Pad" small numbers (with less than 12 "significant" bits) and eliminate zero values (in case someone takes a logarithm)
- !where (RVec < TwoM12) RVec = RVec + TwoM24 * Seeds(J24)
- !where (Rvec == 0.0) RVec = TwoM24 * TwoM24
- !bjj end of modifications
Kount = Kount + LEnv
if (Kount >= IGiga) then
@@ -152,21 +133,12 @@ subroutine RLuxIn (ISDext)
integer :: I, ISD
! start subroutine RLuxIn
if (Size(ISDext) /= NSeeds) then
-!begin bjj
-! print *, " Array size for RLuxIn must be ", NSeeds
-! write( RanLux_str, '(I5)' ) NSeeds
-! CALL WrScr( " Array size for RLuxIn must be "//TRIM( ADJUSTL(RanLux_str) ) )
-!end bjj
return
end if
! The following IF block added by Phillip Helbig, based on conversation with Fred James;
! an equivalent correction has been published by James.
if (NotYet) then
-!begin bjj
-! print *, " Proper results only with initialisation from 25 integers obtained with RLuxUt"
-! CALL WrScr( " Proper results only with initialisation from 25 integers obtained with RLuxUt" )
-!end bjj
NotYet = .FALSE.
end if
TwoM24 = 1.0
@@ -174,13 +146,6 @@ subroutine RLuxIn (ISDext)
TwoM24 = TwoM24 * 0.5
end do
TwoM12 = TwoM24 * 4096.0
-!Start bjj
-! print *, " Full initialization of RanLux with 25 integers:"
-! print *, ISDext
-! CALL WrScr ( " Full initialization of RanLux with 25 integers:" )
-! write( RanLux_str, '(25(I11,1x))' ) ISDext
-! CALL WrScr ( TRIM( RanLux_str ) )
-!End bjj
Seeds = Real (ISDext(: NSeeds - 1)) * TwoM24
Carry = 0.0
if (ISDext(NSeeds) < 0) Carry = TwoM24
@@ -199,22 +164,10 @@ subroutine RLuxIn (ISDext)
if (LuxLev <= MaxLev) then
NSkip = NDSkip(LuxLev)
-!start bjj
-! print *, " RanLux luxury level set by RLuxIn to: ", LuxLev\
-! CALL WrScr( " RanLux luxury level set by RLuxIn to: "//TRIM(ADJUSTL(RanLux_str) ))
-!end bjj
else if (LuxLev >= NSeeds - 1) then
NSkip = LuxLev - NSeeds + 1
-!start bjj
-! print *, " RanLux p-value set by RLuxIn to:", LuxLev
-! CALL WrScr( " RanLux p-value set by RLuxIn to: "//TRIM(ADJUSTL(RanLux_str) ))
-!end bjj
else
NSkip = NDSkip(MaxLev)
-!start bjj
-! print *, " RanLux illegal luxury RLuxIn: ", LuxLev
-! CALL WrScr( " RanLux illegal luxury RLuxIn: "//TRIM(ADJUSTL(RanLux_str) ))
-!end bjj
LuxLev = MaxLev
end if
InSeed = - 1
@@ -227,11 +180,6 @@ subroutine RLuxUt (ISDext)
! start subroutine RLuxUt
if (Size(ISDext) /= NSeeds) then
ISDext = 0
-!start bjj
-! print *, " Array size for RLuxUt must be ", NSeeds
-! write( RanLux_str, '(I20)' ) NSeeds
-! CALL WrScr( " Array size for RLuxUt must be "//TRIM( ADJUSTL(RanLux_str )))
-!end bjj
return
end if
ISDext(: NSeeds - 1) = Int (Seeds * TwoP12 * TwoP12)
@@ -261,11 +209,6 @@ subroutine RLuxGo (Lux, Int, K1, K2)
LuxLev = Lux
else if (Lux < NSeeds - 1 .or. Lux > 2000) then
LuxLev = MaxLev
-!start bjj
-! print *, " RanLux illegal luxury level in RLuxGo: ", Lux
-! write( RanLux_str, '(I20)' ) Lux
-! Call WrScr( " RanLux illegal luxury level in RLuxGo: "//TRIM( ADJUSTL(RanLux_str ) ))
-!end bjj
else
LuxLev = Lux
do ILx = 0, MaxLev
@@ -276,39 +219,15 @@ subroutine RLuxGo (Lux, Int, K1, K2)
end if
if (LuxLev <= MaxLev) then
NSkip = NDSkip(LuxLev)
-!start bjj
-! print *, " RanLux luxury level set by RLuxGo :", LuxLev, " p = ", NSkip + NSeeds - 1
-! write (RanLux_str, '(A,I5)') " RanLux luxury level set by RLuxGo :", LuxLev
-! write (RanLux_str, '(A,I12)') TRIM(RanLux_str)//" p = ", NSkip + NSeeds - 1
-! CALL WrScr( TRIM(RanLux_str) )
-!end bjj
else
NSkip = LuxLev - 24
-!start bjj
-! print *, " RanLux p-value set by RLuxGo to:", LuxLev
-! write( RanLux_str, '(I20)' ) LuxLev
-! CALL WrScr( " RanLux p-value set by RLuxGo to: "//TRIM( ADJUSTL(RanLux_str ) ))
-!end bjj
end if
In24 = 0
if (Int < 0) then
-!start bjj
-! print *, " Illegal initialization by RLuxGo, negative input seed"
-! CALL WrScr( " Illegal initialization by RLuxGo, negative input seed" )
-!end bjj
else if (Int > 0) then
JSeed = Int
-!start bjj
-! print *, " RanLux initialized by RLuxGo from Seeds", JSeed, K1, K2
-! write( RanLux_str, '(3(I12))' ) JSeed, K1, K2
-! CALL WrScr( " RanLux initialized by RLuxGo from Seeds"//TRIM( RanLux_str ) )
-!end bjj
else
JSeed = JSDFlt
-!start bjj
-! print *, " RanLux initialized by RLuxGo from default seed"
-! CALL WrScr( " RanLux initialized by RLuxGo from default seed" )
-!end bjj
end if
InSeed = JSeed
NotYet = .FALSE.
@@ -343,12 +262,6 @@ subroutine RLuxGo (Lux, Int, K1, K2)
end if
! Now IN24 had better be between zero and 23 inclusive
if ((In24 < 1) .or. (In24 >= NSeeds - 1)) then
-!start bjj
-! print *, " Error in restarting with RLuxGo: the values", Int, K1, K2, " cannot occur at luxury level", LuxLev
-! write( RanLux_str, '(A,3(I12),A,I5)' ) " Error in restarting with RLuxGo: the values ", Int, K1, K2, &
-! " cannot occur at luxury level ", LuxLev
-! CALL WrScr( TRIM(RanLux_str ) )
-!end bjj
In24 = 0
end if
end if
diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90
index 8da17998e8..c7b44503a3 100644
--- a/modules/openfast-library/src/FAST_Subs.f90
+++ b/modules/openfast-library/src/FAST_Subs.f90
@@ -832,33 +832,6 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
RETURN
END IF
- ! Need to set up other module's InitInput data here because we will also need to clean up SeaState data and would rather not defer that cleanup
- if ( p_FAST%CompHydro == Module_HD ) then
- Init%InData_HD%NStepWave = Init%OutData_SeaSt%NStepWave
- Init%InData_HD%NStepWave2 = Init%OutData_SeaSt%NStepWave2
- Init%InData_HD%RhoXg = Init%OutData_SeaSt%RhoXg
- Init%InData_HD%WaveMod = Init%OutData_SeaSt%WaveMod
- Init%InData_HD%WaveStMod = Init%OutData_SeaSt%WaveStMod
- Init%InData_HD%WaveDirMod = Init%OutData_SeaSt%WaveDirMod
- Init%InData_HD%WvLowCOff = Init%OutData_SeaSt%WvLowCOff
- Init%InData_HD%WvHiCOff = Init%OutData_SeaSt%WvHiCOff
- Init%InData_HD%WvLowCOffD = Init%OutData_SeaSt%WvLowCOffD
- Init%InData_HD%WvHiCOffD = Init%OutData_SeaSt%WvHiCOffD
- Init%InData_HD%WvLowCOffS = Init%OutData_SeaSt%WvLowCOffS
- Init%InData_HD%WvHiCOffS = Init%OutData_SeaSt%WvHiCOffS
- Init%InData_HD%InvalidWithSSExctn = Init%OutData_SeaSt%InvalidWithSSExctn
-
- Init%InData_HD%WaveDirMin = Init%OutData_SeaSt%WaveDirMin
- Init%InData_HD%WaveDirMax = Init%OutData_SeaSt%WaveDirMax
- Init%InData_HD%WaveDir = Init%OutData_SeaSt%WaveDir
- Init%InData_HD%WaveMultiDir = Init%OutData_SeaSt%WaveMultiDir
- Init%InData_HD%WaveDOmega = Init%OutData_SeaSt%WaveDOmega
- Init%InData_HD%MCFD = Init%OutData_SeaSt%MCFD
-
- Init%InData_HD%WaveField => Init%OutData_SeaSt%WaveField
-
- end if
-
end if
! ........................
@@ -874,15 +847,18 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
IF ( p_FAST%CompHydro == Module_HD ) THEN
Init%InData_HD%Gravity = p_FAST%Gravity
- Init%InData_HD%WtrDens = Init%OutData_SeaSt%WtrDens
- Init%InData_HD%WtrDpth = Init%OutData_SeaSt%WtrDpth
- Init%InData_HD%MSL2SWL = Init%OutData_SeaSt%MSL2SWL
Init%InData_HD%UseInputFile = .TRUE.
Init%InData_HD%InputFile = p_FAST%HydroFile
Init%InData_HD%OutRootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_HD))
Init%InData_HD%TMax = p_FAST%TMax
Init%InData_HD%Linearize = p_FAST%Linearize
if (p_FAST%WrVTK /= VTK_None) Init%InData_HD%VisMeshes=.true.
+
+ ! if ( p_FAST%CompSeaSt == Module_SeaSt ) then ! this is always true
+ Init%InData_HD%InvalidWithSSExctn = Init%OutData_SeaSt%InvalidWithSSExctn
+ Init%InData_HD%WaveField => Init%OutData_SeaSt%WaveField
+ ! end if
+
CALL HydroDyn_Init( Init%InData_HD, HD%Input(1), HD%p, HD%x(STATE_CURR), HD%xd(STATE_CURR), HD%z(STATE_CURR), &
HD%OtherSt(STATE_CURR), HD%y, HD%m, p_FAST%dt_module( MODULE_HD ), Init%OutData_HD, ErrStat2, ErrMsg2 )
@@ -936,7 +912,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
IF ( p_FAST%CompSub == Module_SD ) THEN
IF ( p_FAST%CompHydro == Module_HD ) THEN
- Init%InData_SD%WtrDpth = Init%OutData_SeaSt%WtrDpth
+ Init%InData_SD%WtrDpth = Init%OutData_SeaSt%WaveField%WtrDpth
ELSE
Init%InData_SD%WtrDpth = 0.0_ReKi
END IF
@@ -1053,13 +1029,12 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
! Init%InData_MAP%rootname = p_FAST%OutFileRoot ! Output file name
Init%InData_MAP%gravity = p_FAST%Gravity ! This need to be according to g from driver
- Init%InData_MAP%sea_density = Init%OutData_SeaSt%WtrDens ! This needs to be set according to seawater density in SeaState
- Init%InData_MAP%depth = Init%OutData_SeaSt%WtrDpth ! This need to be set according to the water depth in SeaState
+ Init%InData_MAP%sea_density = Init%OutData_SeaSt%WaveField%WtrDens ! This needs to be set according to seawater density in SeaState
! differences for MAP++
Init%InData_MAP%file_name = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file.
Init%InData_MAP%summary_file_name = TRIM(p_FAST%OutFileRoot)//'.MAP.sum' ! Output file name
- Init%InData_MAP%depth = -Init%OutData_SeaSt%WtrDpth ! This need to be set according to the water depth in SeaState
+ Init%InData_MAP%depth = -Init%OutData_SeaSt%WaveField%WtrDpth ! This need to be set according to the water depth in SeaState
Init%InData_MAP%LinInitInp%Linearize = p_FAST%Linearize
@@ -1106,8 +1081,8 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
Init%InData_MD%FarmSize = 0 ! 0 here indicates normal FAST module use of MoorDyn, for a single turbine
Init%InData_MD%TurbineRefPos(:,1) = 0.0_DbKi ! for normal FAST use, the global reference frame is at 0,0,0
Init%InData_MD%g = p_FAST%Gravity ! This need to be according to g used in ElastoDyn
- Init%InData_MD%rhoW = Init%OutData_SeaSt%WtrDens ! This needs to be set according to seawater density in SeaState
- Init%InData_MD%WtrDepth = Init%OutData_SeaSt%WtrDpth ! This need to be set according to the water depth in SeaState
+ Init%InData_MD%rhoW = Init%OutData_SeaSt%WaveField%WtrDens ! This needs to be set according to seawater density in SeaState
+ Init%InData_MD%WtrDepth = Init%OutData_SeaSt%WaveField%WtrDpth ! This need to be set according to the water depth in SeaState
Init%InData_MD%Tmax = p_FAST%TMax ! expected simulation duration (used by MoorDyn for wave kinematics preprocesing)
Init%InData_MD%Linearize = p_FAST%Linearize
@@ -1151,7 +1126,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
Init%InData_FEAM%PtfmInit = Init%OutData_ED%PlatformPos !ED%x(STATE_CURR)%QT(1:6) ! initial position of the platform !bjj: this should come from Init%OutData_ED, not x_ED
Init%InData_FEAM%NStepWave = 1 ! an arbitrary number > 0 (to set the size of the wave data, which currently contains all zero values)
Init%InData_FEAM%gravity = p_FAST%Gravity ! This need to be according to g from driver
- Init%InData_FEAM%WtrDens = Init%OutData_SeaSt%WtrDens ! This needs to be set according to seawater density in SeaState
+ Init%InData_FEAM%WtrDens = Init%OutData_SeaSt%WaveField%WtrDens ! This needs to be set according to seawater density in SeaState
! Init%InData_FEAM%depth = Init%OutData_SeaSt%WtrDpth ! This need to be set according to the water depth in SeaState
CALL FEAM_Init( Init%InData_FEAM, FEAM%Input(1), FEAM%p, FEAM%x(STATE_CURR), FEAM%xd(STATE_CURR), FEAM%z(STATE_CURR), &
@@ -1240,7 +1215,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
Init%InData_IceF%InputFile = p_FAST%IceFile
Init%InData_IceF%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceF))
Init%InData_IceF%simLength = p_FAST%TMax !bjj: IceFloe stores this as single-precision (ReKi) TMax is DbKi
- Init%InData_IceF%MSL2SWL = Init%OutData_SeaSt%MSL2SWL
+ Init%InData_IceF%MSL2SWL = Init%OutData_SeaSt%WaveField%MSL2SWL
Init%InData_IceF%gravity = p_FAST%Gravity
CALL IceFloe_Init( Init%InData_IceF, IceF%Input(1), IceF%p, IceF%x(STATE_CURR), IceF%xd(STATE_CURR), IceF%z(STATE_CURR), &
@@ -1262,8 +1237,8 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
Init%InData_IceD%InputFile = p_FAST%IceFile
Init%InData_IceD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceD))//'1'
- Init%InData_IceD%MSL2SWL = Init%OutData_SeaSt%MSL2SWL
- Init%InData_IceD%WtrDens = Init%OutData_SeaSt%WtrDens
+ Init%InData_IceD%MSL2SWL = Init%OutData_SeaSt%WaveField%MSL2SWL
+ Init%InData_IceD%WtrDens = Init%OutData_SeaSt%WaveField%WtrDens
Init%InData_IceD%gravity = p_FAST%Gravity
Init%InData_IceD%TMax = p_FAST%TMax
Init%InData_IceD%LegNum = 1
@@ -6525,7 +6500,7 @@ SUBROUTINE WrVTK_WaveElev(t_global, p_FAST, y_FAST, SeaSt)
! I'm not going to interpolate in time; I'm just going to get the index of the closest wave time value
t = REAL(t_global,SiKi)
- call GetWaveElevIndx( t, SeaSt%p%WaveTime, y_FAST%VTK_LastWaveIndx )
+ call GetWaveElevIndx( t, SeaSt%p%WaveField%WaveTime, y_FAST%VTK_LastWaveIndx )
n = 1
do ix=1,p_FAST%VTK_surface%NWaveElevPts(1)
@@ -7757,8 +7732,6 @@ SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turb
! deal with sibling meshes here:
! (ignoring for now; they are not going to be siblings on restart)
- Turbine%HD%p%PointsToSeaState = .false. ! since the pointers aren't pointing to the same data as SeaState after restart, set this to avoid memory leaks and deallocation problems
-
! deal with files that were open:
IF (Turbine%p_FAST%WrTxtOutFile) THEN
CALL OpenFunkFileAppend ( Turbine%y_FAST%UnOu, TRIM(Turbine%p_FAST%OutFileRoot)//'.out', ErrStat2, ErrMsg2)
diff --git a/modules/seastate/src/Current.f90 b/modules/seastate/src/Current.f90
index 68af11a166..5d57f642e5 100644
--- a/modules/seastate/src/Current.f90
+++ b/modules/seastate/src/Current.f90
@@ -42,7 +42,7 @@ MODULE Current
!JASON: MOVE THIS USER-DEFINED ROUTINE (UserCurrent) TO THE UserSubs.f90 OF HydroDyn WHEN THE PLATFORM LOADING FUNCTIONALITY HAS BEEN DOCUMENTED!!!!!
!> This is a dummy routine for holding the place of a user-specified
!! current profile. Modify this code to create your own profile.
-SUBROUTINE UserCurrent ( zi, WtrDpth, DirRoot, CurrVxi, CurrVyi )
+SUBROUTINE UserCurrent ( zi, EffWtrDpth, DirRoot, CurrVxi, CurrVyi )
IMPLICIT NONE
@@ -51,8 +51,8 @@ SUBROUTINE UserCurrent ( zi, WtrDpth, DirRoot, CurrVxi, CurrVyi )
REAL(SiKi), INTENT(OUT) :: CurrVxi !< xi-component of the current velocity at elevation zi, m/s.
REAL(SiKi), INTENT(OUT) :: CurrVyi !< yi-component of the current velocity at elevation zi, m/s.
- REAL(SiKi), INTENT(IN ) :: WtrDpth !< Water depth ( WtrDpth > 0 ), meters.
- REAL(SiKi), INTENT(IN ) :: zi !< Elevation (-WtrDpth <= zi <= 0 ), meters.
+ REAL(SiKi), INTENT(IN ) :: EffWtrDpth !< Effective water depth ( EffWtrDpth > 0 ), meters.
+ REAL(SiKi), INTENT(IN ) :: zi !< Elevation (-EffWtrDpth <= zi <= 0 ), meters.
CHARACTER(*), INTENT(IN ) :: DirRoot !< The name of the root file including the full path to the current working directory. This may be useful if you want this routine to write a permanent record of what it does to be stored with the simulation results: the results should be stored in a file whose name (including path) is generated by appending any suitable extension to DirRoot.
@@ -86,7 +86,7 @@ SUBROUTINE Calc_Current( InitInp, z, h , DirRoot, CurrVxi, CurrVyi )
REAL(SiKi), INTENT(OUT) :: CurrVxi !< xi-component of the current velocity at elevation z (m/s)
REAL(SiKi), INTENT(OUT) :: CurrVyi !< yi-component of the current velocity at elevation z (m/s)
- REAL(SiKi), INTENT(IN ) :: h !< Water depth (meters) This quantity must be positive-valued
+ REAL(SiKi), INTENT(IN ) :: h !< Effective water depth (meters) This quantity must be positive-valued
REAL(SiKi), INTENT(IN ) :: z !< Elevation relative to the mean sea level (meters)
CHARACTER(*), INTENT(IN ) :: DirRoot !< The name of the root file including the full path to the current working directory.
!! This may be useful if you want this routine to write a permanent record of what it does
@@ -207,7 +207,7 @@ SUBROUTINE Current_Init( InitInp, InitOut, ErrStat, ErrMsg )
DO I = 1, InitInp%NGridPts
- CALL Calc_Current( InitInp, InitInp%WaveKinGridzi(I), InitInp%WtrDpth, InitInp%DirRoot, CurrVxi, CurrVyi )
+ CALL Calc_Current( InitInp, InitInp%WaveKinGridzi(I), InitInp%EffWtrDpth, InitInp%DirRoot, CurrVxi, CurrVyi )
InitOut%CurrVxi(I) = CurrVxi
InitOut%CurrVyi(I) = CurrVyi
@@ -218,8 +218,8 @@ SUBROUTINE Current_Init( InitInp, InitOut, ErrStat, ErrMsg )
! Compute the partial derivative for wave stretching
- CALL Calc_Current( InitInp, 0.0_SiKi, InitInp%WtrDpth, InitInp%DirRoot, CurrVxi0, CurrVyi0 )
- CALL Calc_Current( InitInp, -SmllNmbr, InitInp%WtrDpth, InitInp%DirRoot, CurrVxiS, CurrVyiS )
+ CALL Calc_Current( InitInp, 0.0_SiKi, InitInp%EffWtrDpth, InitInp%DirRoot, CurrVxi0, CurrVyi0 )
+ CALL Calc_Current( InitInp, -SmllNmbr, InitInp%EffWtrDpth, InitInp%DirRoot, CurrVxiS, CurrVyiS )
InitOut%PCurrVxiPz0 = ( CurrVxi0 - CurrVxiS )/SmllNmbr ! xi-direction
InitOut%PCurrVyiPz0 = ( CurrVyi0 - CurrVyiS )/SmllNmbr ! yi-direction
diff --git a/modules/seastate/src/Current.txt b/modules/seastate/src/Current.txt
index a0a501ac32..f4f6ccd0e3 100644
--- a/modules/seastate/src/Current.txt
+++ b/modules/seastate/src/Current.txt
@@ -27,7 +27,7 @@ typedef ^ ^ SiKi Cu
typedef ^ ^ SiKi CurrDIV - - - "" -
typedef ^ ^ SiKi CurrDIDir - - - "" -
typedef ^ ^ INTEGER CurrMod - - - "" -
-typedef ^ ^ SiKi WtrDpth - - - "" -
+typedef ^ ^ SiKi EffWtrDpth - - - "" -
typedef ^ ^ SiKi WaveKinGridzi {:} - - "" -
typedef ^ ^ INTEGER NGridPts - - - "" -
typedef ^ ^ CHARACTER(1024) DirRoot - "" - "" -
diff --git a/modules/seastate/src/Current_Types.f90 b/modules/seastate/src/Current_Types.f90
index f33e649352..e0893fc9ac 100644
--- a/modules/seastate/src/Current_Types.f90
+++ b/modules/seastate/src/Current_Types.f90
@@ -44,7 +44,7 @@ MODULE Current_Types
REAL(SiKi) :: CurrDIV = 0.0_R4Ki !< [-]
REAL(SiKi) :: CurrDIDir = 0.0_R4Ki !< [-]
INTEGER(IntKi) :: CurrMod = 0_IntKi !< [-]
- REAL(SiKi) :: WtrDpth = 0.0_R4Ki !< [-]
+ REAL(SiKi) :: EffWtrDpth = 0.0_R4Ki !< [-]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinGridzi !< [-]
INTEGER(IntKi) :: NGridPts = 0_IntKi !< [-]
CHARACTER(1024) :: DirRoot !< [-]
@@ -80,7 +80,7 @@ subroutine Current_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, E
DstInitInputData%CurrDIV = SrcInitInputData%CurrDIV
DstInitInputData%CurrDIDir = SrcInitInputData%CurrDIDir
DstInitInputData%CurrMod = SrcInitInputData%CurrMod
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
+ DstInitInputData%EffWtrDpth = SrcInitInputData%EffWtrDpth
if (allocated(SrcInitInputData%WaveKinGridzi)) then
LB(1:1) = lbound(SrcInitInputData%WaveKinGridzi)
UB(1:1) = ubound(SrcInitInputData%WaveKinGridzi)
@@ -123,7 +123,7 @@ subroutine Current_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%CurrDIV)
call RegPack(Buf, InData%CurrDIDir)
call RegPack(Buf, InData%CurrMod)
- call RegPack(Buf, InData%WtrDpth)
+ call RegPack(Buf, InData%EffWtrDpth)
call RegPack(Buf, allocated(InData%WaveKinGridzi))
if (allocated(InData%WaveKinGridzi)) then
call RegPackBounds(Buf, 1, lbound(InData%WaveKinGridzi), ubound(InData%WaveKinGridzi))
@@ -160,7 +160,7 @@ subroutine Current_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%CurrMod)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
+ call RegUnpack(Buf, OutData%EffWtrDpth)
if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%WaveKinGridzi)) deallocate(OutData%WaveKinGridzi)
call RegUnpack(Buf, IsAllocAssoc)
diff --git a/modules/seastate/src/SeaSt_WaveField.f90 b/modules/seastate/src/SeaSt_WaveField.f90
index c33c053aaf..c8ffabbc84 100644
--- a/modules/seastate/src/SeaSt_WaveField.f90
+++ b/modules/seastate/src/SeaSt_WaveField.f90
@@ -20,8 +20,9 @@ MODULE SeaSt_WaveField
CONTAINS
!-------------------- Subroutine for wave elevation ------------------!
-FUNCTION WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat, ErrMsg )
+FUNCTION WaveField_GetNodeWaveElev1( WaveField, SeaSt_Interp_m, Time, pos, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(*) ! Position at which free-surface elevation is to be calculated. Third entry ignored if present.
INTEGER(IntKi), INTENT( OUT ) :: ErrStat ! Error status of the operation
@@ -29,7 +30,6 @@ FUNCTION WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat, ErrMsg )
REAL(SiKi) :: WaveField_GetNodeWaveElev1
REAL(SiKi) :: Zeta
- LOGICAL :: FirstWarn_Clamp
CHARACTER(*), PARAMETER :: RoutineName = 'WaveField_GetNodeWaveElev1'
INTEGER(IntKi) :: errStat2
CHARACTER(ErrMsgLen) :: errMsg2
@@ -38,7 +38,7 @@ FUNCTION WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat, ErrMsg )
ErrMsg = ""
IF (ALLOCATED(WaveField%WaveElev1)) THEN
- Zeta = SeaSt_Interp_3D( Time, pos(1:2), WaveField%WaveElev1, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ Zeta = SeaSt_Interp_3D( Time, pos(1:2), WaveField%WaveElev1, WaveField%seast_interp_p, seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
ELSE
Zeta = 0.0_SiKi
@@ -48,8 +48,9 @@ FUNCTION WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat, ErrMsg )
END FUNCTION WaveField_GetNodeWaveElev1
-FUNCTION WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat, ErrMsg )
+FUNCTION WaveField_GetNodeWaveElev2( WaveField, SeaSt_Interp_m, Time, pos, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(*) ! Position at which free-surface elevation is to be calculated. Third entry ignored if present.
INTEGER(IntKi), INTENT( OUT ) :: ErrStat ! Error status of the operation
@@ -57,7 +58,6 @@ FUNCTION WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat, ErrMsg )
REAL(SiKi) :: WaveField_GetNodeWaveElev2
REAL(SiKi) :: Zeta
- LOGICAL :: FirstWarn_Clamp
CHARACTER(*), PARAMETER :: RoutineName = 'WaveField_GetNodeWaveElev2'
INTEGER(IntKi) :: errStat2
CHARACTER(ErrMsgLen) :: errMsg2
@@ -66,7 +66,7 @@ FUNCTION WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat, ErrMsg )
ErrMsg = ""
IF (ALLOCATED(WaveField%WaveElev2)) THEN
- Zeta = SeaSt_Interp_3D( Time, pos(1:2), WaveField%WaveElev2, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ Zeta = SeaSt_Interp_3D( Time, pos(1:2), WaveField%WaveElev2, WaveField%seast_interp_p, seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
ELSE
Zeta = 0.0_SiKi
@@ -76,8 +76,9 @@ FUNCTION WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat, ErrMsg )
END FUNCTION WaveField_GetNodeWaveElev2
-FUNCTION WaveField_GetNodeTotalWaveElev( WaveField, Time, pos, ErrStat, ErrMsg )
+FUNCTION WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, pos, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(*) ! Position at which free-surface elevation is to be calculated. Third entry ignored if present.
INTEGER(IntKi), INTENT( OUT ) :: ErrStat ! Error status of the operation
@@ -85,7 +86,6 @@ FUNCTION WaveField_GetNodeTotalWaveElev( WaveField, Time, pos, ErrStat, ErrMsg )
REAL(SiKi) :: WaveField_GetNodeTotalWaveElev
REAL(SiKi) :: Zeta1, Zeta2
- LOGICAL :: FirstWarn_Clamp
CHARACTER(*), PARAMETER :: RoutineName = 'WaveField_GetNodeTotalWaveElev'
INTEGER(IntKi) :: errStat2
CHARACTER(ErrMsgLen) :: errMsg2
@@ -93,17 +93,18 @@ FUNCTION WaveField_GetNodeTotalWaveElev( WaveField, Time, pos, ErrStat, ErrMsg )
ErrStat = ErrID_None
ErrMsg = ""
- Zeta1 = WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ Zeta1 = WaveField_GetNodeWaveElev1( WaveField, SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- Zeta2 = WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ Zeta2 = WaveField_GetNodeWaveElev2( WaveField, SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
WaveField_GetNodeTotalWaveElev = Zeta1 + Zeta2
END FUNCTION WaveField_GetNodeTotalWaveElev
-SUBROUTINE WaveField_GetNodeWaveNormal( WaveField, Time, pos, r, n, ErrStat, ErrMsg )
+SUBROUTINE WaveField_GetNodeWaveNormal( WaveField, SeaSt_Interp_m, Time, pos, r, n, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
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
@@ -118,17 +119,17 @@ SUBROUTINE WaveField_GetNodeWaveNormal( WaveField, Time, pos, r, n, ErrStat, Err
ErrStat = ErrID_None
ErrMsg = ""
- r1 = MAX(r,1.0e-6) ! In case r is zero
+ r1 = MAX(r,real(1.0e-6,ReKi)) ! In case r is zero
- ZetaP = WaveField_GetNodeTotalWaveElev( WaveField, Time, (/pos(1)+r1,pos(2)/), ErrStat2, ErrMsg2 )
+ ZetaP = WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, (/pos(1)+r1,pos(2)/), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- ZetaM = WaveField_GetNodeTotalWaveElev( WaveField, Time, (/pos(1)-r1,pos(2)/), ErrStat2, ErrMsg2 )
+ ZetaM = WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, (/pos(1)-r1,pos(2)/), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
dZetadx = REAL(ZetaP-ZetaM,ReKi)/(2.0_ReKi*r1)
- ZetaP = WaveField_GetNodeTotalWaveElev( WaveField, Time, (/pos(1),pos(2)+r1/), ErrStat2, ErrMsg2 )
+ ZetaP = WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, (/pos(1),pos(2)+r1/), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- ZetaM = WaveField_GetNodeTotalWaveElev( WaveField, Time, (/pos(1),pos(2)-r1/), ErrStat2, ErrMsg2 )
+ ZetaM = WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, (/pos(1),pos(2)-r1/), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
dZetady = REAL(ZetaP-ZetaM,ReKi)/(2.0_ReKi*r1)
@@ -138,8 +139,9 @@ SUBROUTINE WaveField_GetNodeWaveNormal( WaveField, Time, pos, r, n, ErrStat, Err
END SUBROUTINE WaveField_GetNodeWaveNormal
!-------------------- Subroutine for full wave field kinematics --------------------!
-SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat, ErrMsg )
+SUBROUTINE WaveField_GetNodeWaveKin( WaveField, SeaSt_Interp_m, Time, pos, forceNodeInWater, nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT( INOUT ) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(3)
LOGICAL, INTENT( IN ) :: forceNodeInWater
@@ -156,8 +158,6 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
CHARACTER(*), INTENT( OUT ) :: ErrMsg ! Error message if errStat /= ErrID_None
REAL(ReKi) :: posXY(2), posPrime(3), posXY0(3)
- TYPE(SeaSt_Interp_MiscVarType) :: SeaSt_Interp_m
- LOGICAL :: FirstWarn_Clamp
CHARACTER(*), PARAMETER :: RoutineName = 'WaveField_GetNodeWaveKin'
INTEGER(IntKi) :: errStat2
CHARACTER(ErrMsgLen) :: errMsg2
@@ -170,9 +170,9 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
FAMCF(:) = 0.0
! Wave elevation
- WaveElev1 = WaveField_GetNodeWaveElev1( WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ WaveElev1 = WaveField_GetNodeWaveElev1( WaveField, SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- WaveElev2 = WaveField_GetNodeWaveElev2( WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ WaveElev2 = WaveField_GetNodeWaveElev2( WaveField, SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
WaveElev = WaveElev1 + WaveElev2
@@ -181,16 +181,16 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
IF ( pos(3) <= 0.0_ReKi) THEN ! Node is at or below the SWL
nodeInWater = 1_IntKi
! Use location to obtain interpolated values of kinematics
- CALL SeaSt_Interp_Setup( Time, pos, WaveField%seast_interp_p, seast_interp_m, ErrStat2, ErrMsg2 )
+ CALL SeaSt_Interp_Setup( Time, pos, WaveField%seast_interp_p, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FV(:) = SeaSt_Interp_4D_Vec( WaveField%WaveVel, seast_interp_m, ErrStat2, ErrMsg2 )
+ FV(:) = SeaSt_Interp_4D_Vec( WaveField%WaveVel, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FA(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAcc, seast_interp_m, ErrStat2, ErrMsg2 )
+ FA(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAcc, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FDynP = SeaSt_Interp_4D ( WaveField%WaveDynP, seast_interp_m, ErrStat2, ErrMsg2 )
+ FDynP = SeaSt_Interp_4D ( WaveField%WaveDynP, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF ( ALLOCATED(WaveField%WaveAccMCF) ) THEN
- FAMCF(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAccMCF, seast_interp_m, ErrStat2, ErrMsg2 )
+ FAMCF(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAccMCF, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END IF
ELSE ! Node is above the SWL
@@ -212,23 +212,23 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
IF ( pos(3) <= 0.0_SiKi) THEN ! Node is below the SWL - evaluate wave dynamics as usual
! Use location to obtain interpolated values of kinematics
- CALL SeaSt_Interp_Setup( Time, pos, WaveField%seast_interp_p, seast_interp_m, ErrStat2, ErrMsg2 )
+ CALL SeaSt_Interp_Setup( Time, pos, WaveField%seast_interp_p, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FV(:) = SeaSt_Interp_4D_Vec( WaveField%WaveVel, seast_interp_m, ErrStat2, ErrMsg2 )
+ FV(:) = SeaSt_Interp_4D_Vec( WaveField%WaveVel, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FA(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAcc, seast_interp_m, ErrStat2, ErrMsg2 )
+ FA(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAcc, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FDynP = SeaSt_Interp_4D ( WaveField%WaveDynP, seast_interp_m, ErrStat2, ErrMsg2 )
+ FDynP = SeaSt_Interp_4D ( WaveField%WaveDynP, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF ( ALLOCATED(WaveField%WaveAccMCF) ) THEN
- FAMCF(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAccMCF, seast_interp_m, ErrStat2, ErrMsg2 )
+ FAMCF(:) = SeaSt_Interp_4D_Vec( WaveField%WaveAccMCF, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END IF
ELSE ! Node is above SWL - need wave stretching
! Vertical wave stretching
- CALL SeaSt_Interp_Setup( Time, posXY0, WaveField%seast_interp_p, seast_interp_m, ErrStat2, ErrMsg2 )
+ CALL SeaSt_Interp_Setup( Time, posXY0, WaveField%seast_interp_p, SeaSt_Interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FV(:) = SeaSt_Interp_4D_vec( WaveField%WaveVel, seast_interp_m, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
@@ -243,14 +243,14 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
! Extrapoled wave stretching
IF (WaveField%WaveStMod == 2) THEN
- FV(:) = FV(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveVel0, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
+ FV(:) = FV(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveVel0, WaveField%seast_interp_p, SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FA(:) = FA(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveAcc0, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
+ FA(:) = FA(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveAcc0, WaveField%seast_interp_p, SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- FDynP = FDynP + SeaSt_Interp_3D ( Time, posXY, WaveField%PWaveDynP0, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
+ FDynP = FDynP + SeaSt_Interp_3D ( Time, posXY, WaveField%PWaveDynP0, WaveField%seast_interp_p, SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF ( ALLOCATED(WaveField%WaveAccMCF) ) THEN
- FAMCF(:) = FAMCF(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveAccMCF0, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
+ FAMCF(:) = FAMCF(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveAccMCF0, WaveField%seast_interp_p, SeaSt_Interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END IF
END IF
@@ -294,8 +294,9 @@ SUBROUTINE WaveField_GetNodeWaveKin( WaveField, Time, pos, forceNodeInWater, nod
END SUBROUTINE WaveField_GetNodeWaveKin
!-------------------- Subroutine for wave field velocity only --------------------!
-SUBROUTINE WaveField_GetNodeWaveVel( WaveField, Time, pos, forceNodeInWater, nodeInWater, FV, ErrStat, ErrMsg )
+SUBROUTINE WaveField_GetNodeWaveVel( WaveField, SeaSt_Interp_m, Time, pos, forceNodeInWater, nodeInWater, FV, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(3)
LOGICAL, INTENT( IN ) :: forceNodeInWater
@@ -306,8 +307,6 @@ SUBROUTINE WaveField_GetNodeWaveVel( WaveField, Time, pos, forceNodeInWater, nod
REAL(SiKi) :: WaveElev
REAL(ReKi) :: posXY(2), posPrime(3), posXY0(3)
- TYPE(SeaSt_Interp_MiscVarType) :: SeaSt_Interp_m
- LOGICAL :: FirstWarn_Clamp
CHARACTER(*), PARAMETER :: RoutineName = 'WaveField_GetNodeWaveVel'
INTEGER(IntKi) :: errStat2
CHARACTER(ErrMsgLen) :: errMsg2
@@ -319,7 +318,7 @@ SUBROUTINE WaveField_GetNodeWaveVel( WaveField, Time, pos, forceNodeInWater, nod
posXY0 = (/pos(1),pos(2),0.0_ReKi/)
! Wave elevation
- WaveElev = WaveField_GetNodeTotalWaveElev( WaveField, Time, pos, ErrStat2, ErrMsg2 )
+ WaveElev = WaveField_GetNodeTotalWaveElev( WaveField, SeaSt_Interp_m, Time, pos, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF (WaveField%WaveStMod == 0) THEN ! No wave stretching
@@ -362,7 +361,7 @@ SUBROUTINE WaveField_GetNodeWaveVel( WaveField, Time, pos, forceNodeInWater, nod
! Extrapoled wave stretching
IF (WaveField%WaveStMod == 2) THEN
- FV(:) = FV(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveVel0, WaveField%seast_interp_p, FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
+ FV(:) = FV(:) + SeaSt_Interp_3D_vec( Time, posXY, WaveField%PWaveVel0, WaveField%seast_interp_p, seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 ) * pos(3)
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END IF
@@ -394,8 +393,9 @@ SUBROUTINE WaveField_GetNodeWaveVel( WaveField, Time, pos, forceNodeInWater, nod
END SUBROUTINE WaveField_GetNodeWaveVel
-SUBROUTINE WaveField_GetWaveKin( WaveField, Time, pos, forceNodeInWater, nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat, ErrMsg )
+SUBROUTINE WaveField_GetWaveKin( WaveField, SeaSt_Interp_m, Time, pos, forceNodeInWater, nodeInWater, WaveElev1, WaveElev2, WaveElev, FDynP, FV, FA, FAMCF, ErrStat, ErrMsg )
TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(INOUT) :: SeaSt_Interp_m
REAL(DbKi), INTENT( IN ) :: Time
REAL(ReKi), INTENT( IN ) :: pos(:,:)
LOGICAL, INTENT( IN ) :: forceNodeInWater
@@ -422,7 +422,7 @@ SUBROUTINE WaveField_GetWaveKin( WaveField, Time, pos, forceNodeInWater, nodeInW
NumPoints = size(pos, dim=2)
DO i = 1, NumPoints
- CALL WaveField_GetNodeWaveKin( WaveField, Time, pos(:,i), forceNodeInWater, nodeInWater(i), WaveElev1(i), WaveElev2(i), WaveElev(i), FDynP_node, FV_node, FA_node, FAMCF_node, ErrStat2, ErrMsg2 )
+ CALL WaveField_GetNodeWaveKin( WaveField, SeaSt_Interp_m, Time, pos(:,i), forceNodeInWater, nodeInWater(i), WaveElev1(i), WaveElev2(i), WaveElev(i), FDynP_node, FV_node, FA_node, FAMCF_node, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FDynP(i) = REAL(FDynP_node,ReKi)
FV(:, i) = REAL(FV_node, ReKi)
diff --git a/modules/seastate/src/SeaSt_WaveField.txt b/modules/seastate/src/SeaSt_WaveField.txt
index d46f9fb211..9d5c659752 100644
--- a/modules/seastate/src/SeaSt_WaveField.txt
+++ b/modules/seastate/src/SeaSt_WaveField.txt
@@ -2,26 +2,59 @@
# Data structures for representing wave fields.
#
usefrom SeaState_Interp.txt
+
+param SeaSt_WaveField - INTEGER WaveDirMod_None - 0 - "WaveDirMod = 0 [Directional spreading function is NONE]" -
+param SeaSt_WaveField - INTEGER WaveDirMod_COS2S - 1 - "WaveDirMod = 1 [Directional spreading function is COS2S]" -
+
+param SeaSt_WaveField - INTEGER WaveMod_None - 0 - "WaveMod = 0 [Incident wave kinematics model: NONE (still water)]" -
+param SeaSt_WaveField - INTEGER WaveMod_Regular - 1 - "WaveMod = 1 [Incident wave kinematics model: Regular (periodic)]" -
+param SeaSt_WaveField - INTEGER WaveMod_RegularUsrPh - 10 - "WaveMod = 1P# [Incident wave kinematics model: Regular (user specified phase)]" -
+param SeaSt_WaveField - INTEGER WaveMod_JONSWAP - 2 - "WaveMod = 2 [Incident wave kinematics model: JONSWAP/Pierson-Moskowitz spectrum (irregular)]" -
+param SeaSt_WaveField - INTEGER WaveMod_WhiteNoise - 3 - "WaveMod = 3 [Incident wave kinematics model: White noise spectrum (irregular)]" -
+param SeaSt_WaveField - INTEGER WaveMod_UserSpctrm - 4 - "WaveMod = 4 [Incident wave kinematics model: user-defined spectrum from routine UserWaveSpctrm (irregular)]" -
+param SeaSt_WaveField - INTEGER WaveMod_ExtElev - 5 - "WaveMod = 5 [Incident wave kinematics model: Externally generated wave-elevation time series]" -
+param SeaSt_WaveField - INTEGER WaveMod_ExtFull - 6 - "WaveMod = 6 [Incident wave kinematics model: Externally generated full wave-kinematics time series (invalid for PotMod/=0)]" -
+param SeaSt_WaveField - INTEGER WaveMod_UserFreq - 7 - "WaveMod = 7 [Incident wave kinematics model: user-defined wave frequency components]" -
+
#---------------------------------------------------------------------------------------------------------------------------------------------------------
#
#---------------------------------------------------------------------------------------------------------------------------------------------------------
-typedef SeaSt_WaveField SeaSt_WaveFieldType SiKi WaveTime {:} - - "Time array" (s)
-typedef ^ ^ SiKi WaveDynP {:}{:}{:}{:} - - "Incident wave dynamic pressure" (N/m^2)
-typedef ^ ^ SiKi WaveAcc {:}{:}{:}{:}{:} - - "Incident wave acceleration" (m/s^2)
-typedef ^ ^ SiKi WaveAccMCF {:}{:}{:}{:}{:} - - "Scaled acceleration for MacCamy-Fuchs members" (m/s^2)
-typedef ^ ^ SiKi WaveVel {:}{:}{:}{:}{:} - - "Incident wave velocity" (m/s)
-typedef ^ ^ SiKi PWaveDynP0 {:}{:}{:} - - "Partial derivative of dynamic pressure in the vertical direction at the still water level" (Pa/m)
-typedef ^ ^ SiKi PWaveAcc0 {:}{:}{:}{:} - - "Partial derivative of incident wave acceleration in the vertical direction at the still water level" (m/s^2/m)
-typedef ^ ^ SiKi PWaveAccMCF0 {:}{:}{:}{:} - - "Partial derivative of scaled wave acceleration in the vertical direction at the still water level for MacCamy-Fuchs members" (m/s^2/m)
-typedef ^ ^ SiKi PWaveVel0 {:}{:}{:}{:} - - "Partial derivative of incident wave velocity in the vertical direction at the still water level" (m/s/m)
-typedef ^ ^ SiKi WaveElev0 {:} - - "Instantaneous elevation time-series of incident waves at the platform reference point" (m)
-typedef ^ ^ SiKi WaveElev1 {:}{:}{:} - - "First order wave elevation" (m)
-typedef ^ ^ SiKi WaveElev2 {:}{:}{:} - - "Second order wave elevation" (m)
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "Parameter information from the SeaState Interpolation module" (-)
-typedef ^ ^ IntKi WaveStMod - - - "Wave stretching model"
-typedef ^ ^ ReKi EffWtrDpth - - - "Water depth" (-)
-typedef ^ ^ ReKi MSL2SWL - - - "Vertical distance from mean sea level to still water level" (m)
-typedef ^ ^ SiKi WaveElevC {:}{:}{:} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (m)
-typedef ^ ^ SiKi WaveElevC0 {:}{:} - - "Fourier components of the incident wave elevation at the platform reference point. First column is the real part; second column is the imaginary part" (m)
-typedef ^ ^ SiKi WaveDirArr {:} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
+typedef SeaSt_WaveField SeaSt_WaveFieldType SiKi WaveTime {:} - - "Time array" (s)
+typedef ^ ^ SiKi WaveDynP {:}{:}{:}{:} - - "Incident wave dynamic pressure" (N/m^2)
+typedef ^ ^ SiKi WaveAcc {:}{:}{:}{:}{:} - - "Incident wave acceleration" (m/s^2)
+typedef ^ ^ SiKi WaveAccMCF {:}{:}{:}{:}{:} - - "Scaled acceleration for MacCamy-Fuchs members" (m/s^2)
+typedef ^ ^ SiKi WaveVel {:}{:}{:}{:}{:} - - "Incident wave velocity" (m/s)
+typedef ^ ^ SiKi PWaveDynP0 {:}{:}{:} - - "Partial derivative of dynamic pressure in the vertical direction at the still water level" (Pa/m)
+typedef ^ ^ SiKi PWaveAcc0 {:}{:}{:}{:} - - "Partial derivative of incident wave acceleration in the vertical direction at the still water level" (m/s^2/m)
+typedef ^ ^ SiKi PWaveAccMCF0 {:}{:}{:}{:} - - "Partial derivative of scaled wave acceleration in the vertical direction at the still water level for MacCamy-Fuchs members" (m/s^2/m)
+typedef ^ ^ SiKi PWaveVel0 {:}{:}{:}{:} - - "Partial derivative of incident wave velocity in the vertical direction at the still water level" (m/s/m)
+typedef ^ ^ SiKi WaveElev0 {:} - - "Instantaneous elevation time-series of incident waves at the platform reference point (NOTE THAT THIS CAN GET MODIFIED IN WAMIT)" (m)
+typedef ^ ^ SiKi WaveElev1 {:}{:}{:} - - "First order wave elevation" (m)
+typedef ^ ^ SiKi WaveElev2 {:}{:}{:} - - "Second order wave elevation" (m)
+typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "Parameter information from the SeaState Interpolation module" (-)
+typedef ^ ^ IntKi WaveStMod - - - "Wave stretching model"
+typedef ^ ^ ReKi EffWtrDpth - - - "Water depth" (-)
+typedef ^ ^ ReKi MSL2SWL - - - "Vertical distance from mean sea level to still water level" (m)
+typedef ^ ^ SiKi WaveElevC {:}{:}{:} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (m)
+typedef ^ ^ SiKi WaveElevC0 {:}{:} - - "Fourier components of the incident wave elevation at the platform reference point. First column is the real part; second column is the imaginary part" (m)
+typedef ^ ^ SiKi WaveDirArr {:} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
+
+typedef ^ ^ ReKi WtrDpth - - - "Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default)" (m)
+typedef ^ ^ ReKi WtrDens - - - "Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default)" (kg/m^3)
+typedef ^ ^ SiKi RhoXg - - - "= WtrDens*Gravity" -
+typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction." (degrees)
+typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction." (degrees)
+typedef ^ ^ SiKi WaveDir - - - "Incident wave propagation heading direction" (degrees)
+typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
+typedef ^ ^ SiKi MCFD - - - "Diameter of members that will use the MacCamy-Fuchs diffraction model"
+typedef ^ ^ SiKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
+typedef ^ ^ SiKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
+typedef ^ ^ SiKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
+typedef ^ ^ SiKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
+typedef ^ ^ SiKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
+typedef ^ ^ SiKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
+typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
+typedef ^ ^ INTEGER WaveMod - - - "Incident wave kinematics model: See valid values in SeaSt_WaveField module parameters." -
+typedef ^ ^ INTEGER NStepWave - - - "Total number of frequency components = total number of time steps in the incident wave" -
+typedef ^ ^ INTEGER NStepWave2 - - - "NStepWave / 2" -
diff --git a/modules/seastate/src/SeaSt_WaveField_Types.f90 b/modules/seastate/src/SeaSt_WaveField_Types.f90
index c0626b5641..a6d6262c06 100644
--- a/modules/seastate/src/SeaSt_WaveField_Types.f90
+++ b/modules/seastate/src/SeaSt_WaveField_Types.f90
@@ -34,6 +34,17 @@ MODULE SeaSt_WaveField_Types
USE SeaState_Interp_Types
USE NWTC_Library
IMPLICIT NONE
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveDirMod_None = 0 ! WaveDirMod = 0 [Directional spreading function is NONE] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveDirMod_COS2S = 1 ! WaveDirMod = 1 [Directional spreading function is COS2S] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_None = 0 ! WaveMod = 0 [Incident wave kinematics model: NONE (still water)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_Regular = 1 ! WaveMod = 1 [Incident wave kinematics model: Regular (periodic)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_RegularUsrPh = 10 ! WaveMod = 1P# [Incident wave kinematics model: Regular (user specified phase)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_JONSWAP = 2 ! WaveMod = 2 [Incident wave kinematics model: JONSWAP/Pierson-Moskowitz spectrum (irregular)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_WhiteNoise = 3 ! WaveMod = 3 [Incident wave kinematics model: White noise spectrum (irregular)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_UserSpctrm = 4 ! WaveMod = 4 [Incident wave kinematics model: user-defined spectrum from routine UserWaveSpctrm (irregular)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_ExtElev = 5 ! WaveMod = 5 [Incident wave kinematics model: Externally generated wave-elevation time series] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_ExtFull = 6 ! WaveMod = 6 [Incident wave kinematics model: Externally generated full wave-kinematics time series (invalid for PotMod/=0)] [-]
+ INTEGER(IntKi), PUBLIC, PARAMETER :: WaveMod_UserFreq = 7 ! WaveMod = 7 [Incident wave kinematics model: user-defined wave frequency components] [-]
! ========= SeaSt_WaveFieldType =======
TYPE, PUBLIC :: SeaSt_WaveFieldType
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveTime !< Time array [(s)]
@@ -45,7 +56,7 @@ MODULE SeaSt_WaveField_Types
REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: PWaveAcc0 !< Partial derivative of incident wave acceleration in the vertical direction at the still water level [(m/s^2/m)]
REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: PWaveAccMCF0 !< Partial derivative of scaled wave acceleration in the vertical direction at the still water level for MacCamy-Fuchs members [(m/s^2/m)]
REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: PWaveVel0 !< Partial derivative of incident wave velocity in the vertical direction at the still water level [(m/s/m)]
- REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElev0 !< Instantaneous elevation time-series of incident waves at the platform reference point [(m)]
+ REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElev0 !< Instantaneous elevation time-series of incident waves at the platform reference point (NOTE THAT THIS CAN GET MODIFIED IN WAMIT) [(m)]
REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE :: WaveElev1 !< First order wave elevation [(m)]
REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE :: WaveElev2 !< Second order wave elevation [(m)]
TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< Parameter information from the SeaState Interpolation module [(-)]
@@ -55,6 +66,24 @@ MODULE SeaSt_WaveField_Types
REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE :: WaveElevC !< Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part [(m)]
REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: WaveElevC0 !< Fourier components of the incident wave elevation at the platform reference point. First column is the real part; second column is the imaginary part [(m)]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveDirArr !< Wave direction array. Each frequency has a unique direction of WaveNDir > 1 [(degrees)]
+ REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default) [(m)]
+ REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default) [(kg/m^3)]
+ REAL(SiKi) :: RhoXg = 0.0_R4Ki !< = WtrDens*Gravity [-]
+ REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction. [(degrees)]
+ REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction. [(degrees)]
+ REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Incident wave propagation heading direction [(degrees)]
+ LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
+ REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of members that will use the MacCamy-Fuchs diffraction model [-]
+ REAL(SiKi) :: WvLowCOff = 0.0_R4Ki !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
+ REAL(SiKi) :: WvHiCOff = 0.0_R4Ki !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
+ REAL(SiKi) :: WvLowCOffD = 0.0_R4Ki !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
+ REAL(SiKi) :: WvHiCOffD = 0.0_R4Ki !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
+ REAL(SiKi) :: WvLowCOffS = 0.0_R4Ki !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
+ REAL(SiKi) :: WvHiCOffS = 0.0_R4Ki !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
+ REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
+ INTEGER(IntKi) :: WaveMod = 0_IntKi !< Incident wave kinematics model: See valid values in SeaSt_WaveField module parameters. [-]
+ INTEGER(IntKi) :: NStepWave = 0_IntKi !< Total number of frequency components = total number of time steps in the incident wave [-]
+ INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< NStepWave / 2 [-]
END TYPE SeaSt_WaveFieldType
! =======================
CONTAINS
@@ -257,6 +286,24 @@ subroutine SeaSt_WaveField_CopySeaSt_WaveFieldType(SrcSeaSt_WaveFieldTypeData, D
end if
DstSeaSt_WaveFieldTypeData%WaveDirArr = SrcSeaSt_WaveFieldTypeData%WaveDirArr
end if
+ DstSeaSt_WaveFieldTypeData%WtrDpth = SrcSeaSt_WaveFieldTypeData%WtrDpth
+ DstSeaSt_WaveFieldTypeData%WtrDens = SrcSeaSt_WaveFieldTypeData%WtrDens
+ DstSeaSt_WaveFieldTypeData%RhoXg = SrcSeaSt_WaveFieldTypeData%RhoXg
+ DstSeaSt_WaveFieldTypeData%WaveDirMin = SrcSeaSt_WaveFieldTypeData%WaveDirMin
+ DstSeaSt_WaveFieldTypeData%WaveDirMax = SrcSeaSt_WaveFieldTypeData%WaveDirMax
+ DstSeaSt_WaveFieldTypeData%WaveDir = SrcSeaSt_WaveFieldTypeData%WaveDir
+ DstSeaSt_WaveFieldTypeData%WaveMultiDir = SrcSeaSt_WaveFieldTypeData%WaveMultiDir
+ DstSeaSt_WaveFieldTypeData%MCFD = SrcSeaSt_WaveFieldTypeData%MCFD
+ DstSeaSt_WaveFieldTypeData%WvLowCOff = SrcSeaSt_WaveFieldTypeData%WvLowCOff
+ DstSeaSt_WaveFieldTypeData%WvHiCOff = SrcSeaSt_WaveFieldTypeData%WvHiCOff
+ DstSeaSt_WaveFieldTypeData%WvLowCOffD = SrcSeaSt_WaveFieldTypeData%WvLowCOffD
+ DstSeaSt_WaveFieldTypeData%WvHiCOffD = SrcSeaSt_WaveFieldTypeData%WvHiCOffD
+ DstSeaSt_WaveFieldTypeData%WvLowCOffS = SrcSeaSt_WaveFieldTypeData%WvLowCOffS
+ DstSeaSt_WaveFieldTypeData%WvHiCOffS = SrcSeaSt_WaveFieldTypeData%WvHiCOffS
+ DstSeaSt_WaveFieldTypeData%WaveDOmega = SrcSeaSt_WaveFieldTypeData%WaveDOmega
+ DstSeaSt_WaveFieldTypeData%WaveMod = SrcSeaSt_WaveFieldTypeData%WaveMod
+ DstSeaSt_WaveFieldTypeData%NStepWave = SrcSeaSt_WaveFieldTypeData%NStepWave
+ DstSeaSt_WaveFieldTypeData%NStepWave2 = SrcSeaSt_WaveFieldTypeData%NStepWave2
end subroutine
subroutine SeaSt_WaveField_DestroySeaSt_WaveFieldType(SeaSt_WaveFieldTypeData, ErrStat, ErrMsg)
@@ -401,6 +448,24 @@ subroutine SeaSt_WaveField_PackSeaSt_WaveFieldType(Buf, Indata)
call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
call RegPack(Buf, InData%WaveDirArr)
end if
+ call RegPack(Buf, InData%WtrDpth)
+ call RegPack(Buf, InData%WtrDens)
+ call RegPack(Buf, InData%RhoXg)
+ call RegPack(Buf, InData%WaveDirMin)
+ call RegPack(Buf, InData%WaveDirMax)
+ call RegPack(Buf, InData%WaveDir)
+ call RegPack(Buf, InData%WaveMultiDir)
+ call RegPack(Buf, InData%MCFD)
+ call RegPack(Buf, InData%WvLowCOff)
+ call RegPack(Buf, InData%WvHiCOff)
+ call RegPack(Buf, InData%WvLowCOffD)
+ call RegPack(Buf, InData%WvHiCOffD)
+ call RegPack(Buf, InData%WvLowCOffS)
+ call RegPack(Buf, InData%WvHiCOffS)
+ call RegPack(Buf, InData%WaveDOmega)
+ call RegPack(Buf, InData%WaveMod)
+ call RegPack(Buf, InData%NStepWave)
+ call RegPack(Buf, InData%NStepWave2)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -629,6 +694,42 @@ subroutine SeaSt_WaveField_UnPackSeaSt_WaveFieldType(Buf, OutData)
call RegUnpack(Buf, OutData%WaveDirArr)
if (RegCheckErr(Buf, RoutineName)) return
end if
+ call RegUnpack(Buf, OutData%WtrDpth)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WtrDens)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%RhoXg)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDirMin)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDirMax)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDir)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveMultiDir)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%MCFD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOff)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOff)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOffD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOffD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOffS)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOffS)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDOmega)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveMod)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%NStepWave)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%NStepWave2)
+ if (RegCheckErr(Buf, RoutineName)) return
end subroutine
END MODULE SeaSt_WaveField_Types
!ENDOFREGISTRYGENERATEDFILE
diff --git a/modules/seastate/src/SeaState.f90 b/modules/seastate/src/SeaState.f90
index 827e828c76..9d56069af5 100644
--- a/modules/seastate/src/SeaState.f90
+++ b/modules/seastate/src/SeaState.f90
@@ -91,9 +91,8 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
TYPE(Waves_InitOutputType) :: Waves_InitOut ! Initialization Outputs from the Waves submodule initialization
TYPE(Waves2_InitOutputType) :: Waves2_InitOut ! Initialization Outputs from the Waves2 submodule initialization
TYPE(SeaSt_Interp_InitInputType) :: SeaSt_Interp_InitInp
-! TYPE(Waves2_InitOutputType) :: Waves2_InitOut ! Initialization Outputs from the Waves2 module initialization
TYPE(Current_InitOutputType) :: Current_InitOut ! Initialization Outputs from the Current module initialization
- INTEGER :: I,J,K ! Generic counters
+ INTEGER :: I ! Generic counters
INTEGER :: it ! Generic counters
REAL(ReKi) :: TmpElev ! temporary wave elevation
@@ -117,7 +116,7 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
ErrStat = ErrID_None
ErrMsg = ""
- p%UnOutFile = -1 !bjj: this was being written to the screen when I had an error in my HD input file, so I'm going to initialize here.
+ p%UnOutFile = -1
u%DummyInput = 0 ! initialize dummy variable to make the compiler warnings go away
z%UnusedStates = 0.0
@@ -127,9 +126,6 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
m%SeaSt_Interp_m%FirstWarn_Clamp = .true.
-#ifdef BETA_BUILD
- CALL DispBetaNotice( "This is a beta version of SeaState and is for testing purposes only."//NewLine//"This version includes user waves, WaveMod=6 and the ability to write example user waves." )
-#endif
! Initialize the NWTC Subroutine Library
@@ -182,8 +178,6 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
RETURN
END IF
- p%DT = Interval
-
! Now call each sub-module's *_Init subroutine
! to fully initialize each sub-module based on the necessary initialization data
@@ -214,35 +208,19 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
InputFileData%Waves%PtfmLocationX = InitInp%PtfmLocationX
InputFileData%Waves%PtfmLocationY = InitInp%PtfmLocationY
- ! Allocate the WaveFieldType to store wave field information
- ALLOCATE(p%WaveField)
-
+
! Initialize Waves module (Note that this may change InputFileData%Waves%WaveDT)
CALL Waves_Init(InputFileData%Waves, Waves_InitOut, p%WaveField, ErrStat2, ErrMsg2 )
CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! note that we DO NOT RETURN on error until AFTER the pointers modified, below
- ! Copy Waves_InitOut pointer information before calling cleanup (to avoid memory problems):
- p%WaveTime => p%WaveField%WaveTime
- p%WaveElev1 => p%WaveField%WaveElev1
- p%WaveVel => p%WaveField%WaveVel
- p%WaveAcc => p%WaveField%WaveAcc
- p%WaveDynP => p%WaveField%WaveDynP
- p%PWaveVel0 => p%WaveField%PWaveVel0
- p%PWaveAcc0 => p%WaveField%PWaveAcc0
- p%PWaveDynP0 => p%WaveField%PWaveDynP0
- p%WaveAccMCF => p%WaveField%WaveAccMCF
- p%WaveElevC0 => p%WaveField%WaveElevC0
- p%WaveDirArr => p%WaveField%WaveDirArr
- p%PWaveAccMCF0 => p%WaveField%PWaveAccMCF0
- ! check error (must be done AFTER moving pointers to parameters)
+ ! check error
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
RETURN
END IF
! Copy Waves initialization output into the initialization input type for the WAMIT module
- p%NStepWave = Waves_InitOut%NStepWave
p%WaveDT = InputFileData%Waves%WaveDT
! Store user-requested wave elevation locations
@@ -260,11 +238,11 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
! add some warnings about requesting WriteOutput outside the SeaState domain:
do i=1,p%NWaveKin
- if (abs(p%WaveKinxi(i)) > p%X_HalfWidth) then
+ if (abs(p%WaveKinxi(i)) > InputFileData%X_HalfWidth) then
CALL SetErrStat(ErrID_Warn,'Requested WaveKinxi is outside the SeaState spatial domain.', ErrStat, ErrMsg, RoutineName)
exit
end if
- if (abs(p%WaveKinyi(i)) > p%Y_HalfWidth) then
+ if (abs(p%WaveKinyi(i)) > InputFileData%Y_HalfWidth) then
CALL SetErrStat(ErrID_Warn,'Requested WaveKinyi is outside the SeaState spatial domain.', ErrStat, ErrMsg, RoutineName)
exit
end if
@@ -277,7 +255,7 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
m%LastIndWave = 1
- IF ( InputFileData%Waves%WaveMod /= 6 ) THEN
+ IF ( InputFileData%WaveMod /= WaveMod_ExtFull ) THEN
!----------------------------------
! Initialize Waves2 module
@@ -285,179 +263,58 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
IF (InputFileData%Waves2%WvDiffQTFF .OR. InputFileData%Waves2%WvSumQTFF ) THEN
- ! Set a few things from the Waves module output
- InputFileData%Waves2%NStepWave = Waves_InitOut%NStepWave
- InputFileData%Waves2%NStepWave2 = Waves_InitOut%NStepWave2
- InputFileData%Waves2%WaveDOmega = Waves_InitOut%WaveDOmega
-
- ! Copy the WaveElevXY data in from the SeaState InputFileData
- ! IF (ALLOCATED(tmpWaveElevXY)) CALL MOVE_ALLOC(tmpWaveElevXY, InputFileData%Waves2%WaveElevXY)
-
- ! assign pointer arrays to init input for Waves2 (save some space)
-
- InputFileData%Waves2%WaveTime => p%WaveTime
- InputFileData%Waves2%WaveElevC0 => Waves_InitOut%WaveElevC0
- InputFileData%Waves2%WaveDirArr => Waves_InitOut%WaveDirArr
-
- CALL Waves2_Init(InputFileData%Waves2, p%Waves2, Waves2_InitOut, p%WaveField, ErrStat2, ErrMsg2 )
- p%WaveElev2 => p%WaveField%WaveElev2 ! do this before calling cleanup() so that pointers get deallocated properly
-
+ CALL Waves2_Init(InputFileData%Waves2, Waves2_InitOut, p%WaveField, ErrStat2, ErrMsg2 )
CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
RETURN
END IF
- ! If we calculated wave elevations, it is now stored in p%WaveElev. So we need to add the corrections.
- IF (InputFileData%Waves2%NWaveElevGrid > 0 ) THEN
- ! Make sure the sizes of the two resulting arrays are identical...
- IF ( SIZE(p%WaveElev1,DIM=1) /= SIZE(p%WaveElev2,DIM=1) .OR. &
- SIZE(p%WaveElev1,DIM=2) /= SIZE(p%WaveElev2,DIM=2)) THEN
- CALL SetErrStat(ErrID_Fatal,' WaveElev(NWaveElev) arrays for first and second order wave elevations are of different sizes.',ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- InitOut%WaveElev2 => p%WaveElev2
- ENDIF
- ENDIF
-
! The acceleration, velocity, and dynamic pressures will get added to the parts passed to the morrison module later...
! Difference frequency results
- IF ( p%Waves2%WvDiffQTFF ) THEN
-
- ! Dynamic pressure -- difference frequency terms
- IF ( SIZE(p%WaveDynP,DIM=1) /= SIZE(Waves2_InitOut%WaveDynP2D,DIM=1) .OR. &
- SIZE(p%WaveDynP,DIM=2) /= SIZE(Waves2_InitOut%WaveDynP2D,DIM=2).OR. &
- SIZE(p%WaveDynP,DIM=3) /= SIZE(Waves2_InitOut%WaveDynP2D,DIM=3).OR. &
- SIZE(p%WaveDynP,DIM=4) /= SIZE(Waves2_InitOut%WaveDynP2D,DIM=4)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveDynP arrays for first and second order wave elevations are of different sizes. '//NewLine// &
- 'Waves: '// TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=1)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=2)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=3)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=4)))//NewLine// &
- 'Waves2: '// TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=1)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=2)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=3)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=4))), &
- ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveDynP = p%WaveField%WaveDynP + Waves2_InitOut%WaveDynP2D
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveDynP0 = WaveDynP0 + WaveDynP2D0
- ENDIF
+ IF ( InputFileData%Waves2%WvDiffQTFF ) THEN
- ! Particle velocity -- difference frequency terms
- IF ( SIZE(p%WaveVel,DIM=1) /= SIZE(Waves2_InitOut%WaveVel2D,DIM=1) .OR. &
- SIZE(p%WaveVel,DIM=2) /= SIZE(Waves2_InitOut%WaveVel2D,DIM=2) .OR. &
- SIZE(p%WaveVel,DIM=3) /= SIZE(Waves2_InitOut%WaveVel2D,DIM=3) .OR. &
- SIZE(p%WaveVel,DIM=4) /= SIZE(Waves2_InitOut%WaveVel2D,DIM=4) .OR. &
- SIZE(p%WaveVel,DIM=5) /= SIZE(Waves2_InitOut%WaveVel2D,DIM=5)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveVel arrays for first and second order wave elevations are of different sizes.',ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveVel = p%WaveField%WaveVel + Waves2_InitOut%WaveVel2D
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveVel0 = WaveVel0 + WaveVel2D0
- ENDIF
+ ! Dynamic pressure -- difference frequency terms
+ CALL AddArrays_4D(p%WaveField%WaveDynP, Waves2_InitOut%WaveDynP2D,'WaveDynP_D', ErrStat2, ErrMsg2) ! WaveDynP = WaveDynP + WaveDynP2D
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+ ! Particle velocity -- difference frequency terms
+ CALL AddArrays_5D(p%WaveField%WaveVel, Waves2_InitOut%WaveVel2D,'WaveVel_D', ErrStat2, ErrMsg2) ! WaveVel = WaveVel + WaveVel2D
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
! Particle acceleration -- difference frequency terms
- IF ( SIZE(p%WaveAcc,DIM=1) /= SIZE(Waves2_InitOut%WaveAcc2D,DIM=1) .OR. &
- SIZE(p%WaveAcc,DIM=2) /= SIZE(Waves2_InitOut%WaveAcc2D,DIM=2) .OR. &
- SIZE(p%WaveAcc,DIM=3) /= SIZE(Waves2_InitOut%WaveAcc2D,DIM=3) .OR. &
- SIZE(p%WaveAcc,DIM=4) /= SIZE(Waves2_InitOut%WaveAcc2D,DIM=4) .OR. &
- SIZE(p%WaveAcc,DIM=5) /= SIZE(Waves2_InitOut%WaveAcc2D,DIM=5)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveAcc arrays for first and second order wave elevations are of different sizes.',ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveAcc = p%WaveField%WaveAcc + Waves2_InitOut%WaveAcc2D
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveAcc0 = WaveAcc0 + WaveAcc2D0
- ! MacCamy-Fuchs scaled acceleration should not contain second-order contributions
- !IF (InputFileData%Waves%MCFD > 0) THEN
- ! p%WaveAccMCF = p%WaveAccMCF + Waves2_InitOut%WaveAcc2D
- !END IF
-
- ENDIF
+ CALL AddArrays_5D(p%WaveField%WaveAcc, Waves2_InitOut%WaveAcc2D,'WaveAcc_D', ErrStat2, ErrMsg2) ! WaveAcc = WaveAcc + WaveAcc2D
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
+
ENDIF ! second order wave kinematics difference frequency results
! Sum frequency results
- IF ( p%Waves2%WvSumQTFF ) THEN
+ IF ( InputFileData%Waves2%WvSumQTFF ) THEN
! Dynamic pressure -- sum frequency terms
- IF ( SIZE(p%WaveDynP,DIM=1) /= SIZE(Waves2_InitOut%WaveDynP2S,DIM=1) .OR. &
- SIZE(p%WaveDynP,DIM=2) /= SIZE(Waves2_InitOut%WaveDynP2S,DIM=2) .OR. &
- SIZE(p%WaveDynP,DIM=3) /= SIZE(Waves2_InitOut%WaveDynP2S,DIM=3) .OR. &
- SIZE(p%WaveDynP,DIM=4) /= SIZE(Waves2_InitOut%WaveDynP2S,DIM=4)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveDynP arrays for first and second order wave elevations are of different sizes. '//NewLine// &
- 'Waves: '// TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=1)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=2)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=3)))//'x'// &
- TRIM(Num2LStr(SIZE(p%WaveDynP,DIM=4)))//NewLine// &
- 'Waves2: '// TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=1)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=2)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=3)))//'x'// &
- TRIM(Num2LStr(SIZE(Waves2_InitOut%WaveDynP2D,DIM=4))), &
- ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveDynP = p%WaveField%WaveDynP + Waves2_InitOut%WaveDynP2S
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveDynP0 = WaveDynP0 + WaveDynP2S0
- ENDIF
+ CALL AddArrays_4D(p%WaveField%WaveDynP, Waves2_InitOut%WaveDynP2S,'WaveDynP_S', ErrStat2, ErrMsg2) ! WaveDynP = WaveDynP + WaveDynP2S
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
! Particle velocity -- sum frequency terms
- IF ( SIZE(p%WaveVel,DIM=1) /= SIZE(Waves2_InitOut%WaveVel2S,DIM=1) .OR. &
- SIZE(p%WaveVel,DIM=2) /= SIZE(Waves2_InitOut%WaveVel2S,DIM=2) .OR. &
- SIZE(p%WaveVel,DIM=3) /= SIZE(Waves2_InitOut%WaveVel2S,DIM=3) .OR. &
- SIZE(p%WaveVel,DIM=4) /= SIZE(Waves2_InitOut%WaveVel2S,DIM=4) .OR. &
- SIZE(p%WaveVel,DIM=5) /= SIZE(Waves2_InitOut%WaveVel2S,DIM=5)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveVel arrays for first and second order wave elevations are of different sizes.',ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveVel = p%WaveField%WaveVel + Waves2_InitOut%WaveVel2S
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveVel0 = WaveVel0 + WaveVel2S0
- ENDIF
+ CALL AddArrays_5D(p%WaveField%WaveVel, Waves2_InitOut%WaveVel2S,'WaveVel_S', ErrStat2, ErrMsg2) ! WaveVel = WaveVel + WaveVel2S
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
- ! Particle velocity -- sum frequency terms
- IF ( SIZE(p%WaveAcc,DIM=1) /= SIZE(Waves2_InitOut%WaveAcc2S,DIM=1) .OR. &
- SIZE(p%WaveAcc,DIM=2) /= SIZE(Waves2_InitOut%WaveAcc2S,DIM=2) .OR. &
- SIZE(p%WaveAcc,DIM=3) /= SIZE(Waves2_InitOut%WaveAcc2S,DIM=3) .OR. &
- SIZE(p%WaveAcc,DIM=4) /= SIZE(Waves2_InitOut%WaveAcc2S,DIM=4) .OR. &
- SIZE(p%WaveAcc,DIM=5) /= SIZE(Waves2_InitOut%WaveAcc2S,DIM=5)) THEN
- CALL SetErrStat(ErrID_Fatal, &
- ' WaveAcc arrays for first and second order wave elevations are of different sizes.',ErrStat,ErrMsg,RoutineName)
- CALL CleanUp()
- RETURN
- ELSE
- p%WaveField%WaveAcc = p%WaveField%WaveAcc + Waves2_InitOut%WaveAcc2S
- !IF (InputFileData%Waves%WaveStMod > 0 ) WaveAcc0 = WaveAcc0 + WaveAcc2S0
- ! MacCamy-Fuchs scaled accleration should not contain second-order contributions
- !IF (InputFileData%Waves%MCFD > 0) THEN
- ! p%WaveAccMCF = p%WaveAccMCF + Waves2_InitOut%WaveAcc2S
- !END IF
- ENDIF
+ ! Particle acceleration -- sum frequency terms
+ ! Note: MacCamy-Fuchs scaled accleration should not contain second-order contributions
+ CALL AddArrays_5D(p%WaveField%WaveAcc, Waves2_InitOut%WaveAcc2S,'WaveAcc_S', ErrStat2, ErrMsg2) ! WaveAcc = WaveAcc + WaveAcc2S
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
ENDIF ! second order wave kinematics sum frequency results
+
ELSE
! these need to be set to zero since we don't have a UseWaves2 flag:
InputFileData%Waves2%NWaveElevGrid = 0
- p%Waves2%WvDiffQTFF = .FALSE.
- p%Waves2%WvSumQTFF = .FALSE.
-
ENDIF ! InputFileData%Waves2%WvDiffQTFF .OR. InputFileData%Waves2%WvSumQTFF
- END IF ! Check for WaveMod = 6
+ END IF ! Check for WaveMod = 6 (WaveMod_ExtFull)
! Create the Output file if requested
p%OutSwtch = InputFileData%OutSwtch
@@ -469,16 +326,6 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
! Define initialization-routine output here:
InitOut%Ver = SeaSt_ProgDesc
! These three come directly from processing the inputs, and so will exist even if not using Morison elements:
- InitOut%WtrDens = InputFileData%Waves%WtrDens
- InitOut%WtrDpth = InputFileData%Waves%WtrDpth - InputFileData%MSL2SWL
- InitOut%EffWtrDpth = InputFileData%Waves%WtrDpth
- InitOut%MSL2SWL = InputFileData%MSL2SWL
- p%WaveStMod = InputFileData%Waves%WaveStMod
- p%WtrDpth = InitOut%WtrDpth
- p%EffWtrDpth = InitOut%EffWtrDpth
-
- InitOut%WaveMultiDir = InputFileData%Waves%WaveMultiDir
- InitOut%MCFD = InputFileData%Waves%MCFD
CALL SeaStOut_Init( SeaSt_ProgDesc, InitInp%OutRootName, InputFileData, y, p, m, InitOut, ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
@@ -488,103 +335,46 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
!===============================================
- CALL SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrStat2, ErrMsg2)
+ CALL SeaStOut_WrSummaryFile(InitInp, InputFileData, p, ErrStat2, ErrMsg2)
CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
- ! Setup the 4D grid information for the Interpolatin Module
- SeaSt_Interp_InitInp%n = (/p%NStepWave,p%nGrid(1),p%nGrid(2),p%nGrid(3)/)
+ ! Setup the 4D grid information for the Interpolation Module
+ SeaSt_Interp_InitInp%n = (/p%WaveField%NStepWave,p%nGrid(1),p%nGrid(2),p%nGrid(3)/)
SeaSt_Interp_InitInp%delta = (/real(p%WaveDT,ReKi),p%deltaGrid(1),p%deltaGrid(2),p%deltaGrid(3)/)
SeaSt_Interp_InitInp%pZero(1) = 0.0 !Time
SeaSt_Interp_InitInp%pZero(2) = -InputFileData%X_HalfWidth
SeaSt_Interp_InitInp%pZero(3) = -InputFileData%Y_HalfWidth
SeaSt_Interp_InitInp%pZero(4) = -InputFileData%Z_Depth ! zi
- SeaSt_Interp_InitInp%Z_Depth = InputFileData%Z_Depth
- call SeaSt_Interp_Init(SeaSt_Interp_InitInp, p%seast_interp_p, ErrStat2, ErrMsg2)
- CALL SeaSt_Interp_CopyParam( p%seast_interp_p, p%WaveField%seast_interp_p, MESH_NEWCOPY, ErrStat2, ErrMsg2 )
+ SeaSt_Interp_InitInp%Z_Depth = InputFileData%Z_Depth
+ call SeaSt_Interp_Init(SeaSt_Interp_InitInp, p%WaveField%seast_interp_p, ErrStat2, ErrMsg2)
+ CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
IF ( p%OutSwtch == 1 ) THEN ! Only HD-level output writing
! HACK WE can tell FAST not to write any HD outputs by simply deallocating the WriteOutputHdr array!
DEALLOCATE ( InitOut%WriteOutputHdr )
END IF
- ! Copy Waves InitOut data to SeaState InitOut
- ! ... pointer data:
- InitOut%WaveElev1 => p%WaveField%WaveElev1
- InitOut%WaveDynP => p%WaveField%WaveDynP ! For Morison
- InitOut%WaveAcc => p%WaveField%WaveAcc ! For Morison
- InitOut%WaveVel => p%WaveField%WaveVel ! For Morison
- InitOut%PWaveDynP0 => p%WaveField%PWaveDynP0 ! For Morison
- InitOut%PWaveAcc0 => p%WaveField%PWaveAcc0 ! For Morison
- InitOut%PWaveVel0 => p%WaveField%PWaveVel0 ! For Morison
- InitOut%WaveAccMCF => p%WaveField%WaveAccMCF ! For Morison (MacCamy-Fuchs)
- InitOut%WaveTime => p%WaveField%WaveTime ! For Morison, and WAMIT for use in SS_Excitation
- InitOut%WaveElevC0 => p%WaveField%WaveElevC0 ! For WAMIT and WAMIT2, FIT
- InitOut%WaveDirArr => p%WaveField%WaveDirArr ! For WAMIT and WAMIT2
- InitOut%PWaveAccMCF0 => p%WaveField%PWaveAccMCF0 ! For Morison (MacCamy-Fuchs)
- InitOut%WaveElevC => p%WaveField%WaveElevC ! For WAMIT
- InitOut%WaveElev0 => p%WaveField%WaveElev0
-
- ! non-pointer data:
- InitOut%WaveDirMin = Waves_InitOut%WaveDirMin ! For WAMIT and WAMIT2
- InitOut%WaveDirMax = Waves_InitOut%WaveDirMax ! For WAMIT and WAMIT2
- InitOut%WaveDOmega = Waves_InitOut%WaveDOmega ! For WAMIT and WAMIT2, FIT
-
- InitOut%RhoXg = Waves_InitOut%RhoXg ! For WAMIT and WAMIT2
- InitOut%NStepWave = Waves_InitOut%NStepWave ! For WAMIT, WAMIT2, SS_Excitation, Morison
- InitOut%NStepWave2 = Waves_InitOut%NStepWave2 ! For WAMIT and WAMIT2, FIT
-
- InitOut%WaveMod = InputFileData%Waves%WaveMod
- InitOut%WaveStMod = InputFileData%Waves%WaveStMod
- InitOut%WvLowCOff = InputFileData%Waves%WvLowCOff
- InitOut%WvHiCOff = InputFileData%Waves%WvHiCOff
- InitOut%WvLowCOffD = InputFileData%Waves2%WvLowCOffD
- InitOut%WvHiCOffD = InputFileData%Waves2%WvHiCOffD
- InitOut%WvLowCOffS = InputFileData%Waves2%WvLowCOffS
- InitOut%WvHiCOffS = InputFileData%Waves2%WvHiCOffS
- InitOut%WaveDirMod = InputFileData%Waves%WaveDirMod
- InitOut%WaveDir = InputFileData%Waves%WaveDir ! For WAMIT for use in SS_Excitation
- ! InitOut%WtrDens = InputFileData%Waves%WtrDens
- ! InitOut%WtrDpth = InputFileData%Waves%WtrDpth
- ! InitOut%MSL2SWL = InputFileData%MSL2SWL
-
- InitOut%SeaSt_Interp_p = p%seast_interp_p
-
- ! Build WaveField
- p%WaveField%MSL2SWL = InitOut%MSL2SWL
- p%WaveField%EffWtrDpth = p%EffWtrDpth ! Effective water depth measured from the SWL
- p%WaveField%WaveStMod = p%WaveStMod
- ! p%WaveField%WaveTime => Waves_InitOut%WaveTime
- ! p%WaveField%WaveElev1 => Waves_InitOut%WaveElev
- ! p%WaveField%WaveVel => Waves_InitOut%WaveVel
- ! p%WaveField%WaveAcc => Waves_InitOut%WaveAcc
- ! p%WaveField%WaveDynP => Waves_InitOut%WaveDynP
- ! p%WaveField%PWaveVel0 => Waves_InitOut%PWaveVel0
- ! p%WaveField%PWaveAcc0 => Waves_InitOut%PWaveAcc0
- ! p%WaveField%PWaveDynP0 => Waves_InitOut%PWaveDynP0
- ! p%WaveField%WaveAccMCF => Waves_InitOut%WaveAccMCF
- ! p%WaveField%PWaveAccMCF0 => Waves_InitOut%PWaveAccMCF0
-
- ! CALL SeaSt_WaveField_CopySeaSt_WaveFieldType( p%WaveField, InitOut%WaveField, MESH_NEWCOPY, ErrStat2, ErrMsg2)
InitOut%WaveField => p%WaveField
! Tell HydroDyn if state-space wave excitation is not allowed:
- InitOut%InvalidWithSSExctn = InputFileData%Waves%WaveMod == 6 .or. & !call SetErrStat( ErrID_Fatal, 'Externally generated full wave-kinematics time series cannot be used with state-space wave excitations. Set WaveMod 0, 1, 1P#, 2, 3, 4, or 5.', ErrStat, ErrMsg, RoutineName )
- InputFileData%Waves%WaveDirMod /= 0 .or. & !call SetErrStat( ErrID_Fatal, 'Directional spreading cannot be used with state-space wave excitations. Set WaveDirMod=0.', ErrStat, ErrMsg, RoutineName )
- InputFileData%Waves2%WvDiffQTFF .or. & !call SetErrStat( ErrID_Fatal, 'Cannot use full difference-frequency 2nd-order wave kinematics with state-space wave excitations. Set WvDiffQTF=FALSE.', ErrStat, ErrMsg, RoutineName )
- InputFileData%Waves2%WvSumQTFF !call SetErrStat( ErrID_Fatal, 'Cannot use full summation-frequency 2nd-order wave kinematics with state-space wave excitations. Set WvSumQTF=FALSE.', ErrStat, ErrMsg, RoutineName )
+ InitOut%InvalidWithSSExctn = InputFileData%WaveMod == WaveMod_ExtFull .or. & !call SetErrStat( ErrID_Fatal, 'Externally generated full wave-kinematics time series cannot be used with state-space wave excitations. Set WaveMod 0, 1, 1P#, 2, 3, 4, or 5.', ErrStat, ErrMsg, RoutineName )
+ InputFileData%WaveDirMod /= WaveDirMod_None .or. & !call SetErrStat( ErrID_Fatal, 'Directional spreading cannot be used with state-space wave excitations. Set WaveDirMod=0.', ErrStat, ErrMsg, RoutineName )
+ InputFileData%Waves2%WvDiffQTFF .or. & !call SetErrStat( ErrID_Fatal, 'Cannot use full difference-frequency 2nd-order wave kinematics with state-space wave excitations. Set WvDiffQTF=FALSE.', ErrStat, ErrMsg, RoutineName )
+ InputFileData%Waves2%WvSumQTFF !call SetErrStat( ErrID_Fatal, 'Cannot use full summation-frequency 2nd-order wave kinematics with state-space wave excitations. Set WvSumQTF=FALSE.', ErrStat, ErrMsg, RoutineName )
! Write Wave Kinematics?
- if ( InputFileData%Waves%WaveMod /= 6 ) then
+ if ( InputFileData%WaveMod /= WaveMod_ExtFull ) then
if ( InitInp%WrWvKinMod == 2 ) then
- call SeaStOut_WriteWvKinFiles( InitInp%OutRootname, SeaSt_ProgDesc, p%NStepWave, p%WaveDT, p%X_HalfWidth, p%Y_HalfWidth, &
- p%Z_Depth, p%deltaGrid, p%NGrid, InitOut%WaveElev1, InitOut%WaveElev2, &
- InitOut%WaveVel, InitOut%WaveAcc, InitOut%WaveDynP, ErrStat, ErrMsg )
+ call SeaStOut_WriteWvKinFiles( InitInp%OutRootname, SeaSt_ProgDesc, p%WaveField, p%WaveDT, InputFileData%X_HalfWidth, InputFileData%Y_HalfWidth, &
+ p%deltaGrid, p%NGrid, ErrStat2, ErrMsg2 )
+ call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
else if ( InitInp%WrWvKinMod == 1 ) then
- call SeaStOut_WriteWaveElev0(InitInp%OutRootname, p%NStepWave, &
- p%NGrid, InitOut%WaveElev1, InitOut%WaveElev2, &
- InitOut%WaveTime, ErrStat, ErrMsg )
+ call SeaStOut_WriteWaveElev0(InitInp%OutRootname, p%WaveField%NStepWave, &
+ p%NGrid, p%WaveField%WaveElev1, p%WaveField%WaveElev2, &
+ p%WaveField%WaveTime, ErrStat2, ErrMsg2 )
+ call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
end if
end if
@@ -594,24 +384,24 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
IF (ALLOCATED(InitInp%WaveElevXY)) THEN
! maybe instead of getting these requested points, we just output the grid that SeaState is generated on?
- ALLOCATE(InitOut%WaveElevSeries( 0:InitOut%NStepWave, 1:SIZE(InitInp%WaveElevXY, DIM=2)),STAT=ErrStat2)
+ ALLOCATE(InitOut%WaveElevSeries( 0:p%WaveField%NStepWave, 1:SIZE(InitInp%WaveElevXY, DIM=2)),STAT=ErrStat2)
if (ErrStat2 /= 0) then
CALL SetErrStat(ErrID_Fatal,"Error allocating InitOut%WaveElevSeries.",ErrStat,ErrMsg,RoutineName)
CALL CleanUp()
RETURN
end if
- do it = 1,size(p%WaveTime)
+ do it = 1,size(p%WaveField%WaveTime)
do i = 1, size(InitOut%WaveElevSeries,DIM=2)
- InitOut%WaveElevSeries(it,i) = SeaSt_Interp_3D( real(p%WaveTime(it),DbKi), real(InitInp%WaveElevXY(:,i),ReKi), p%WaveElev1, p%seast_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ InitOut%WaveElevSeries(it,i) = SeaSt_Interp_3D( real(p%WaveField%WaveTime(it),DbKi), real(InitInp%WaveElevXY(:,i),ReKi), p%WaveField%WaveElev1, p%WaveField%seast_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
end do
end do
- if (associated(p%WaveElev2)) then
- do it = 1,size(p%WaveTime)
+ if (allocated(p%WaveField%WaveElev2)) then
+ do it = 1,size(p%WaveField%WaveTime)
do i = 1, size(InitOut%WaveElevSeries,DIM=2)
- TmpElev = SeaSt_Interp_3D( real(p%WaveTime(it),DbKi), real(InitInp%WaveElevXY(:,i),ReKi), p%WaveElev2, p%seast_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
+ TmpElev = SeaSt_Interp_3D( real(p%WaveField%WaveTime(it),DbKi), real(InitInp%WaveElevXY(:,i),ReKi), p%WaveField%WaveElev2, p%WaveField%seast_interp_p, m%seast_interp_m%FirstWarn_Clamp, ErrStat2, ErrMsg2 )
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
InitOut%WaveElevSeries(it,i) = InitOut%WaveElevSeries(it,i) + TmpElev
end do
@@ -623,18 +413,18 @@ SUBROUTINE SeaSt_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
IF ( InitInp%hasIce ) THEN
- IF ((InputFileData%Waves%WaveMod /= 0) .OR. (InputFileData%Current%CurrMod /= 0) ) THEN
+ IF ((InputFileData%WaveMod /= WaveMod_None) .OR. (InputFileData%Current%CurrMod /= 0) ) THEN
CALL SetErrStat(ErrID_Fatal,'Waves and Current must be turned off in SeaState when ice loading is computed. Set WaveMod=0 and CurrMod=0.',ErrStat,ErrMsg,RoutineName)
END IF
END IF
if (InitInp%Linearize) then
- if ( InputFileData%Waves%WaveMod /= 0 ) then
+ if ( InputFileData%WaveMod /= WaveMod_None ) then
call SetErrStat( ErrID_Fatal, 'Still water conditions must be used for linearization. Set WaveMod=0.', ErrStat, ErrMsg, RoutineName )
end if
- if ( InputFileData%Waves%WaveDirMod /= 0 ) then
+ if ( InputFileData%WaveDirMod /= WaveDirMod_None ) then
call SetErrStat( ErrID_Fatal, 'No directional spreading must be used for linearization. Set WaveDirMod=0.', ErrStat, ErrMsg, RoutineName )
end if
@@ -669,10 +459,6 @@ SUBROUTINE CleanUp()
if (allocated(tmpWaveKinzi )) deallocate(tmpWaveKinzi )
if (allocated(tmpWaveElevxi)) deallocate(tmpWaveElevxi)
if (allocated(tmpWaveElevyi)) deallocate(tmpWaveElevyi)
- ! if (allocated(WaveElevSt )) deallocate(WaveElevSt )
- ! if (allocated(WaveVel0 )) deallocate(WaveVel0 )
- ! if (allocated(WaveAcc0 )) deallocate(WaveAcc0 )
- ! if (allocated(WaveDynP0 )) deallocate(WaveDynP0 )
if (allocated(WaveVel2S0 )) deallocate(WaveVel2S0 )
if (allocated(WaveAcc2S0 )) deallocate(WaveAcc2S0 )
if (allocated(WaveDynP2S0 )) deallocate(WaveDynP2S0 )
@@ -682,9 +468,73 @@ SUBROUTINE CleanUp()
END SUBROUTINE CleanUp
!................................
+
END SUBROUTINE SeaSt_Init
+!----------------------------------------------------------------------------------------------------------------------------------
+SUBROUTINE AddArrays_4D(Array1, Array2, ArrayName, ErrStat, ErrMsg)
+ REAL(SiKi), INTENT(INOUT) :: Array1(:,:,:,:)
+ REAL(SiKi), INTENT(IN ) :: Array2(:,:,:,:)
+ CHARACTER(*), INTENT(IN ) :: ArrayName
+ INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
+ CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
+
+ ErrStat = ErrID_None
+ ErrMsg = ""
+ IF ( SIZE(Array1,DIM=1) /= SIZE(Array2,DIM=1) .OR. &
+ SIZE(Array1,DIM=2) /= SIZE(Array2,DIM=2) .OR. &
+ SIZE(Array1,DIM=3) /= SIZE(Array2,DIM=3) .OR. &
+ SIZE(Array1,DIM=4) /= SIZE(Array2,DIM=4)) THEN
+
+ ErrStat = ErrID_Fatal
+ ErrMsg = TRIM(ArrayName)//' arrays for first and second order wave elevations are of different sizes: '//NewLine// &
+ 'Waves: '// TRIM(Num2LStr(SIZE(Array1,DIM=1)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=2)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=3)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=4)))//NewLine// &
+ 'Waves2: '// TRIM(Num2LStr(SIZE(Array2,DIM=1)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=2)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=3)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=4)))
+ ELSE
+ Array1 = Array1 + Array2
+ ENDIF
+
+END SUBROUTINE AddArrays_4D
+!----------------------------------------------------------------------------------------------------------------------------------
+SUBROUTINE AddArrays_5D(Array1, Array2, ArrayName, ErrStat, ErrMsg)
+ REAL(SiKi), INTENT(INOUT) :: Array1(:,:,:,:,:)
+ REAL(SiKi), INTENT(IN ) :: Array2(:,:,:,:,:)
+ CHARACTER(*), INTENT(IN ) :: ArrayName
+ INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
+ CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
+
+ IF ( SIZE(Array1,DIM=1) /= SIZE(Array2,DIM=1) .OR. &
+ SIZE(Array1,DIM=2) /= SIZE(Array2,DIM=2) .OR. &
+ SIZE(Array1,DIM=3) /= SIZE(Array2,DIM=3) .OR. &
+ SIZE(Array1,DIM=4) /= SIZE(Array2,DIM=4) .OR. &
+ SIZE(Array1,DIM=5) /= SIZE(Array2,DIM=5)) THEN
+
+ ErrStat = ErrID_Fatal
+ ErrMsg = TRIM(ArrayName)//' arrays for first and second order wave elevations are of different sizes: '//NewLine// &
+ 'Waves: '// TRIM(Num2LStr(SIZE(Array1,DIM=1)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=2)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=3)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=4)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array1,DIM=5)))//NewLine// &
+ 'Waves2: '// TRIM(Num2LStr(SIZE(Array2,DIM=1)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=2)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=3)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=4)))//'x'// &
+ TRIM(Num2LStr(SIZE(Array2,DIM=5)))
+ ELSE
+ ErrStat = ErrID_None
+ ErrMsg = ""
+ Array1 = Array1 + Array2
+ ENDIF
+
+END SUBROUTINE AddArrays_5D
!----------------------------------------------------------------------------------------------------------------------------------
!> This routine is called at the end of the simulation.
SUBROUTINE SeaSt_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
@@ -823,9 +673,6 @@ SUBROUTINE SeaSt_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, Er
REAL(SiKi) :: zeta
REAL(SiKi) :: zeta1
REAL(SiKi) :: zeta2
- REAL(SiKi) :: zp
- REAL(ReKi) :: positionXYZp(3)
- REAL(ReKi) :: positionXY0(3)
INTEGER(IntKi) :: nodeInWater
@@ -859,7 +706,7 @@ SUBROUTINE SeaSt_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, Er
DO i = 1, p%NWaveKin
positionXYZ = (/p%WaveKinxi(i),p%WaveKinyi(i),p%WaveKinzi(i)/)
- CALL WaveField_GetNodeWaveKin( p%WaveField, Time, positionXYZ, .FALSE., nodeInWater, zeta1, zeta2, zeta, WaveDynP(i), WaveVel(:,i), WaveAcc(:,i), WaveAccMCF(:,i), ErrStat2, ErrMsg2 )
+ CALL WaveField_GetNodeWaveKin( p%WaveField, m%seast_interp_m, Time, positionXYZ, .FALSE., nodeInWater, zeta1, zeta2, zeta, WaveDynP(i), WaveVel(:,i), WaveAcc(:,i), WaveAccMCF(:,i), ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
END DO
@@ -867,9 +714,9 @@ SUBROUTINE SeaSt_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, Er
DO i = 1, p%NWaveElev
positionXY = (/p%WaveElevxi(i),p%WaveElevyi(i)/)
- WaveElev1(i) = WaveField_GetNodeWaveElev1( p%WaveField, Time, positionXY, ErrStat2, ErrMsg2 )
+ WaveElev1(i) = WaveField_GetNodeWaveElev1( p%WaveField, m%SeaSt_Interp_m, Time, positionXY, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
- WaveElev2(i) = WaveField_GetNodeWaveElev2( p%WaveField, Time, positionXY, ErrStat2, ErrMsg2 )
+ WaveElev2(i) = WaveField_GetNodeWaveElev2( p%WaveField, m%SeaSt_Interp_m, Time, positionXY, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
WaveElev(i) = WaveElev1(i) + WaveElev2(i)
END DO
diff --git a/modules/seastate/src/SeaState.txt b/modules/seastate/src/SeaState.txt
index 8e06548d2c..03e659fac1 100644
--- a/modules/seastate/src/SeaState.txt
+++ b/modules/seastate/src/SeaState.txt
@@ -21,32 +21,48 @@ usefrom SeaState_Interp.txt
usefrom SeaSt_WaveField.txt
#
#
-typedef SeaState/SeaSt SeaSt_InputFile LOGICAL EchoFlag - - - "Echo the input file"
-typedef ^ ^ ReKi MSL2SWL - - - "Mean Sea Level to Still Water Level offset" m
-typedef ^ ^ ReKi X_HalfWidth - - - "Half-width of the domain in the X direction" m
-typedef ^ ^ ReKi Y_HalfWidth - - - "Half-width of the domain in the Y direction" m
-typedef ^ ^ ReKi Z_Depth - - - "Depth of the domain the Z direction" m
-typedef ^ ^ INTEGER NX - - - "Number of nodes in half of the X-direction domain"
-typedef ^ ^ INTEGER NY - - - "Number of nodes in half of the Y-direction domain"
-typedef ^ ^ INTEGER NZ - - - "Number of nodes in half of the Z-direction domain"
-typedef ^ ^ Waves_InitInputType Waves - - - "Initialization data for Waves module" -
-typedef ^ ^ Waves2_InitInputType Waves2 - - - "Initialization data for Waves2 module" -
-typedef ^ ^ Current_InitInputType Current - - - "Initialization data for Current module" -
-typedef ^ ^ LOGICAL Echo - - - "Echo the input files to a file with the same name as the input but with a .echo extension [T/F]" -
-typedef ^ ^ INTEGER NWaveElev - - - "Number of user-requested points where the incident wave elevations can be output" -
-typedef ^ ^ SiKi WaveElevxi {:} - - "xi-coordinates for points where the incident wave elevations can be output" (meters)
-typedef ^ ^ SiKi WaveElevyi {:} - - "yi-coordinates for points where the incident wave elevations can be output" (meters)
-typedef ^ ^ INTEGER NWaveKin - - - "Number of points where the incident wave kinematics will be computed" -
-typedef ^ ^ SiKi WaveKinxi {:} - - "xi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
-typedef ^ ^ SiKi WaveKinyi {:} - - "yi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
-typedef ^ ^ SiKi WaveKinzi {:} - - "zi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
-typedef ^ ^ INTEGER OutSwtch - - - "Output requested channels to: [1=SeaState.out 2=GlueCode.out 3=both files]" -
-typedef ^ ^ LOGICAL OutAll - - - "Output all user-specified member and joint loads (only at each member end, not interior locations) [T/F]" -
-typedef ^ ^ INTEGER NumOuts - - - "The number of outputs for this module as requested in the input file" -
-typedef ^ ^ CHARACTER(ChanLen) OutList {:} - - "The user-requested output channel labels for this modules. This should really be dimensioned with MaxOutPts" -
-typedef ^ ^ LOGICAL SeaStSum - - - "Generate a SeaState summary file [T/F]" -
-typedef ^ ^ CHARACTER(20) OutFmt - - - "Output format for numerical results" -
-typedef ^ ^ CHARACTER(20) OutSFmt - - - "Output format for header strings" -
+typedef SeaState/SeaSt SeaSt_InputFile LOGICAL EchoFlag - - - "Echo the input file"
+typedef ^ ^ ReKi MSL2SWL - - - "Mean Sea Level to Still Water Level offset" m
+typedef ^ ^ ReKi X_HalfWidth - - - "Half-width of the domain in the X direction" m
+typedef ^ ^ ReKi Y_HalfWidth - - - "Half-width of the domain in the Y direction" m
+typedef ^ ^ ReKi Z_Depth - - - "Depth of the domain the Z direction" m
+typedef ^ ^ INTEGER NX - - - "Number of nodes in half of the X-direction domain"
+typedef ^ ^ INTEGER NY - - - "Number of nodes in half of the Y-direction domain"
+typedef ^ ^ INTEGER NZ - - - "Number of nodes in half of the Z-direction domain"
+typedef ^ ^ Waves_InitInputType Waves - - - "Initialization data for Waves module" -
+typedef ^ ^ Waves2_InitInputType Waves2 - - - "Initialization data for Waves2 module" -
+typedef ^ ^ Current_InitInputType Current - - - "Initialization data for Current module" -
+typedef ^ ^ LOGICAL Echo - - - "Echo the input files to a file with the same name as the input but with a .echo extension [T/F]" -
+typedef ^ ^ INTEGER NWaveElev - - - "Number of user-requested points where the incident wave elevations can be output" -
+typedef ^ ^ SiKi WaveElevxi {:} - - "xi-coordinates for points where the incident wave elevations can be output" (meters)
+typedef ^ ^ SiKi WaveElevyi {:} - - "yi-coordinates for points where the incident wave elevations can be output" (meters)
+typedef ^ ^ INTEGER NWaveKin - - - "Number of points where the incident wave kinematics will be computed" -
+typedef ^ ^ SiKi WaveKinxi {:} - - "xi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
+typedef ^ ^ SiKi WaveKinyi {:} - - "yi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
+typedef ^ ^ SiKi WaveKinzi {:} - - "zi-coordinates for points where the incident wave kinematics will be computed; these are relative to the mean sea level" (meters)
+typedef ^ ^ INTEGER OutSwtch - - - "Output requested channels to: [1=SeaState.out 2=GlueCode.out 3=both files]" -
+typedef ^ ^ LOGICAL OutAll - - - "Output all user-specified member and joint loads (only at each member end, not interior locations) [T/F]" -
+typedef ^ ^ INTEGER NumOuts - - - "The number of outputs for this module as requested in the input file" -
+typedef ^ ^ CHARACTER(ChanLen) OutList {:} - - "The user-requested output channel labels for this modules. This should really be dimensioned with MaxOutPts" -
+typedef ^ ^ LOGICAL SeaStSum - - - "Generate a SeaState summary file [T/F]" -
+typedef ^ ^ CHARACTER(20) OutFmt - - - "Output format for numerical results" -
+typedef ^ ^ CHARACTER(20) OutSFmt - - - "Output format for header strings" -
+typedef ^ ^ INTEGER WaveStMod - - - "Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching}" -
+typedef ^ ^ ReKi WtrDpth - - - "Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default)" (m)
+typedef ^ ^ ReKi WtrDens - - - "Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default)" (kg/m^3)
+typedef ^ ^ INTEGER WaveDirMod - - - "Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6]" -
+typedef ^ ^ SiKi WaveDir - - - "Incident wave propagation heading direction" (degrees)
+typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional" -
+typedef ^ ^ SiKi MCFD - - - "Diameter of members that will use the MacCamy-Fuchs diffraction model"
+typedef ^ ^ SiKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
+typedef ^ ^ SiKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
+typedef ^ ^ SiKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
+typedef ^ ^ SiKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
+typedef ^ ^ SiKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
+typedef ^ ^ SiKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
+typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
+typedef ^ ^ INTEGER WaveMod - - - "Incident wave kinematics model: See valid values in SeaSt_WaveField module parameters." -
+
typedef SeaState/SeaSt InitInputType CHARACTER(1024) InputFile - - - "Supplied by Driver: full path and filename for the SeaState module" -
typedef ^ ^ LOGICAL UseInputFile - .TRUE. - "Supplied by Driver: .TRUE. if using a input file, .FALSE. if all inputs are being passed in by the caller" -
@@ -71,48 +87,10 @@ typedef ^ ^ Logical Lin
#
typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "The is the list of all HD-related output channel header strings (includes all sub-module channels)" -
typedef ^ ^ CHARACTER(ChanLen) WriteOutputUnt {:} - - "The is the list of all HD-related output channel unit strings (includes all sub-module channels)" -
-typedef ^ ^ ProgDesc Ver - - - "Version of SeaState"
-typedef ^ ^ ReKi WtrDens - - - "Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default)" (kg/m^3)
-typedef ^ ^ ReKi WtrDpth - - - "Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default)" (m)
-typedef ^ ^ ReKi EffWtrDpth - - - "Effective water depth equal to the sum of input WtrDpth and MSL2SWL" (m)
-typedef ^ ^ ReKi MSL2SWL - - - "Offset between still-water level and mean sea level, this is necessary to inform glue-code what the module is using for MSL2SWL (may not be the glue-code's default)" (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 WaveElevC {*}{*}{*} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (meters)
-typedef ^ ^ SiKi WaveDirArr {*} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
-typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction." (degrees)
-typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction." (degrees)
-typedef ^ ^ SiKi WaveDir - - - "Incident wave propagation heading direction" (degrees)
-typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
-typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
-typedef ^ ^ SiKi WaveDynP {*}{*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi WaveAcc {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi WaveAccMCF {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi WaveVel {*}{*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi PWaveDynP0 {*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi PWaveAcc0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi PWaveAccMCF0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi PWaveVel0 {*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi WaveElev1 {*}{*}{*} - - "First order wave elevation" -
-typedef ^ ^ SiKi WaveElev2 {*}{*}{*} - - "Second order wave elevation" -
-typedef ^ ^ SiKi WaveElev0 {*} - - "Instantaneous elevation time-series of incident waves at the platform reference point" (meters)
-typedef ^ ^ SiKi WaveTime {*} - - "Simulation times at which the instantaneous elevation of, velocity of, acceleration of, and loads associated with the incident waves are determined" (sec)
-typedef ^ ^ SiKi RhoXg - - - "= WtrDens*Gravity" -
-typedef ^ ^ INTEGER NStepWave - - - "Total number of frequency components = total number of time steps in the incident wave" -
-typedef ^ ^ INTEGER NStepWave2 - - - "NStepWave / 2" -
-typedef ^ ^ INTEGER WaveMod - - - "Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED }" -
-typedef ^ ^ INTEGER WaveStMod - - - "Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching}" -
-typedef ^ ^ INTEGER WaveDirMod - - - "Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6]" -
-typedef ^ ^ SiKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ LOGICAL InvalidWithSSExctn - - - "Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2)" (-)
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
-typedef ^ ^ SiKi MCFD - - - "Diameter of MacCamy-Fuchs member" (meters)
-typedef ^ ^ SiKi WaveElevSeries {:}{:} - - "Wave elevation time-series at each of the points given by WaveElevXY. First dimension is the timestep. Second dimension is XY point number corresponding to second dimension of WaveElevXY." (m)
-typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
+typedef ^ ^ ProgDesc Ver - - - "Version of SeaState"
+typedef ^ ^ LOGICAL InvalidWithSSExctn - - - "Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2)" (-)
+typedef ^ ^ SiKi WaveElevSeries {:}{:} - - "Wave elevation time-series at each of the points given by WaveElevXY. First dimension is the timestep. Second dimension is XY point number corresponding to second dimension of WaveElevXY." (m)
+typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
#
#
# ..... States ....................................................................................................................
@@ -134,51 +112,26 @@ typedef ^ OtherStateType R8Ki Unu
# ..... Misc/Optimization variables.................................................................................................
# 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 Decimate - - - "The output decimation counter" -
-typedef ^ ^ DbKi LastOutTime - - - "Last time step which was written to the output file (sec)" -
-typedef ^ ^ INTEGER LastIndWave - - - "The last index used in the wave kinematics arrays, used to optimize interpolation" -
-typedef ^ ^ SeaSt_Interp_MiscVarType SeaSt_Interp_m - - - "misc var information from the SeaState Interpolation module" -
+typedef ^ MiscVarType INTEGER Decimate - - - "The output decimation counter" -
+typedef ^ ^ DbKi LastOutTime - - - "Last time step which was written to the output file (sec)" -
+typedef ^ ^ INTEGER LastIndWave - - - "The last index used in the wave kinematics arrays, used to optimize interpolation" -
+typedef ^ ^ SeaSt_Interp_MiscVarType SeaSt_Interp_m - - - "misc var information from the SeaState Interpolation module" -
# ..... Parameters ................................................................................................................
# Define parameters here:
# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states:
#
-typedef ^ ParameterType Waves2_ParameterType Waves2 - - - "Parameter data for the Waves2 module" -
-typedef ^ ^ SiKi WaveTime {*} - - "Array of time samples, (sec)" -
-typedef ^ ^ DbKi WaveDT - - - "Wave DT" sec
+typedef ^ ParameterType DbKi WaveDT - - - "Wave DT" sec
typedef ^ ^ INTEGER NGridPts - - - "Number of data points in the wave kinematics grid" -
typedef ^ ^ INTEGER NGrid 3 - - "Number of grid entries in x, y, and z"
typedef ^ ^ ReKi deltaGrid 3 - - "delta between grid points in x, y, and theta (for z)" m,m,rad
-typedef ^ ^ ReKi X_HalfWidth - - - "Half-width of the domain in the X direction" m
-typedef ^ ^ ReKi Y_HalfWidth - - - "Half-width of the domain in the Y direction" m
-typedef ^ ^ ReKi Z_Depth - - - "Depth of the domain the Z direction" m
-typedef ^ ^ INTEGER NStepWave - - - "Number of user-requested data points in the wave kinematics arrays" -
typedef ^ ^ INTEGER NWaveElev - - - "Number of wave elevation outputs" -
typedef ^ ^ SiKi WaveElevxi {:} - - "xi-coordinates for points where the incident wave elevations can be output" (meters)
typedef ^ ^ SiKi WaveElevyi {:} - - "yi-coordinates for points where the incident wave elevations can be output" (meters)
-typedef ^ ^ SiKi WaveElev1 {*}{*}{*} - - "First order wave elevation" -
-typedef ^ ^ SiKi WaveElev2 {*}{*}{*} - - "Second order wave elevation" -
-typedef ^ ^ SiKi PWaveDynP0 {*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi WaveDynP {*}{*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi WaveAcc {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi PWaveAcc0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi WaveVel {*}{*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi PWaveVel0 {*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi WaveAccMCF {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed" (m/s^2)
-#### vvvvvvvvvvvvvvvvvvvvvvvvv
-#### The following 3 parameters aren't used in SeaState after initialization, but are stored as parameters so that we can deallocate the arrays and nullify the pointers in a consistent way (in one module)
-typedef ^ ^ SiKi WaveDirArr {*} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
-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 PWaveAccMCF0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed" (m/s^2)
-#### ^^^^^^^^^^^^^^^^^^^^^^^^^
typedef ^ ^ INTEGER NWaveKin - - - "Number of points where the incident wave kinematics can be output" -
typedef ^ ^ SiKi WaveKinxi {:} - - "xi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level" (meters)
typedef ^ ^ SiKi WaveKinyi {:} - - "yi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level" (meters)
typedef ^ ^ SiKi WaveKinzi {:} - - "zi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level" (meters)
-typedef ^ ^ ReKi WtrDpth - - - "Water depth" (m)
-typedef ^ ^ ReKi EffWtrDpth - - - "Effective water depth equal to the sum of input WtrDpth and MSL2SWL" (m)
-typedef ^ ^ DbKi DT - - - "Time step in seconds for integration of continuous states (if a fixed-step integrator is used) and update of discrete states" -
-typedef ^ ^ IntKi WaveStMod - - - "Wave stretching model" -
typedef ^ ^ OutParmType OutParam {:} - - "" -
typedef ^ ^ INTEGER NumOuts - - - "Number of SeaState module-level outputs (not the total number including sub-modules" -
typedef ^ ^ INTEGER OutSwtch - - - "Output requested channels to: [1=SeaState.out 2=GlueCode.out 3=both files]" -
@@ -187,7 +140,6 @@ typedef ^ ^ CHARACTER(20) Out
typedef ^ ^ CHARACTER(1) Delim - - - "Delimiter string for outputs, defaults to space" -
typedef ^ ^ INTEGER UnOutFile - - - "File unit for the SeaState outputs" -
typedef ^ ^ INTEGER OutDec - - - "Write every OutDec time steps" -
-typedef ^ ^ SeaSt_Interp_ParameterType SeaSt_Interp_p - - - "parameter information from the SeaState Interpolation module" -
typedef ^ ^ SeaSt_WaveFieldType &WaveField - - - "Wave field"
#
#
diff --git a/modules/seastate/src/SeaState_DriverCode.f90 b/modules/seastate/src/SeaState_DriverCode.f90
index ae6bad8550..276352fbd3 100644
--- a/modules/seastate/src/SeaState_DriverCode.f90
+++ b/modules/seastate/src/SeaState_DriverCode.f90
@@ -624,8 +624,6 @@ SUBROUTINE WaveElevGrid_Output (drvrInitInp, SeaStateInitInp, SeaStateInitOut, S
ErrMsg = ""
ErrStat = ErrID_None
- ErrMsgTmp = ""
- ErrStatTmp = ErrID_None
! If we calculated the wave elevation at a set of coordinates for use with making movies, put it into an output file
@@ -637,12 +635,12 @@ SUBROUTINE WaveElevGrid_Output (drvrInitInp, SeaStateInitInp, SeaStateInitOut, S
if ( ErrStat >= AbortErrLev ) return
end if
- if (associated(SeaState_p%WaveElev2)) then
- maxWaveVal = MAXVAL(SeaState_p%WaveElev1+SeaState_p%WaveElev2)
- minWaveVal = MINVAL(SeaState_p%WaveElev1+SeaState_p%WaveElev2)
+ if (allocated(SeaState_p%WaveField%WaveElev2)) then
+ maxWaveVal = MAXVAL(SeaState_p%WaveField%WaveElev1 + SeaState_p%WaveField%WaveElev2)
+ minWaveVal = MINVAL(SeaState_p%WaveField%WaveElev1 + SeaState_p%WaveField%WaveElev2)
else
- maxWaveVal = MAXVAL(SeaState_p%WaveElev1)
- minWaveVal = MINVAL(SeaState_p%WaveElev1)
+ maxWaveVal = MAXVAL(SeaState_p%WaveField%WaveElev1)
+ minWaveVal = MINVAL(SeaState_p%WaveField%WaveElev1)
end if
! Write some useful header information
@@ -654,8 +652,8 @@ SUBROUTINE WaveElevGrid_Output (drvrInitInp, SeaStateInitInp, SeaStateInitOut, S
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '## It is arranged as blocks of X,Y,Elevation at each timestep'
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '## Each block is separated by two blank lines for use in gnuplot'
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# '
- write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# WaveTMax = '//TRIM(Num2LStr(SeaState_p%WaveTime(SeaState_P%NStepWave)))
- write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# NStepWave = '//TRIM(Num2LStr(SeaState_p%NStepWave))
+ write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# WaveTMax = '//TRIM(Num2LStr(SeaState_p%WaveField%WaveTime(SeaState_p%WaveField%NStepWave)))
+ write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# NStepWave = '//TRIM(Num2LStr(SeaState_p%WaveField%NStepWave))
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# GridXPoints = '//TRIM(Num2LStr(SeaState_p%NGrid(1)))
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# GridYPoints = '//TRIM(Num2LStr(SeaState_p%NGrid(2)))
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# GridDX = '//TRIM(Num2LStr(SeaState_p%deltaGrid(1)))
@@ -665,18 +663,18 @@ SUBROUTINE WaveElevGrid_Output (drvrInitInp, SeaStateInitInp, SeaStateInitOut, S
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) '# '
! Timestep looping
- do i = 0,SeaState_p%NStepWave
+ do i = 0,SeaState_p%WaveField%NStepWave
write (WaveElevFileUn,'(A)', IOSTAT=ErrStatTmp ) NewLine
- write (WaveElevFileUn,'(A8,F10.3)', IOSTAT=ErrStatTmp ) '# Time: ',SeaState_p%WaveTime(I)
+ write (WaveElevFileUn,'(A8,F10.3)', IOSTAT=ErrStatTmp ) '# Time: ',SeaState_p%WaveField%WaveTime(I)
! Now output the X,Y, Elev info for this timestep
do j=1,SeaState_p%NGrid(1)
xpos = -SeaState_p%deltaGrid(1)*(SeaState_p%NGrid(1)-1)/2.0 + (J-1)*SeaState_p%deltaGrid(1)
do k=1, SeaState_p%NGrid(2)
ypos = -SeaState_p%deltaGrid(2)*(SeaState_p%NGrid(2)-1)/2.0 + (K-1)*SeaState_p%deltaGrid(2)
- if (associated(SeaState_p%WaveElev2)) then
- WaveElev = SeaState_p%WaveElev1(I,J,K) + SeaState_p%WaveElev2(I,J,K)
+ if (allocated(SeaState_p%WaveField%WaveElev2)) then
+ WaveElev = SeaState_p%WaveField%WaveElev1(I,J,K) + SeaState_p%WaveField%WaveElev2(I,J,K)
else
- WaveElev = SeaState_p%WaveElev1(I,J,K)
+ WaveElev = SeaState_p%WaveField%WaveElev1(I,J,K)
end if
write (WaveElevFileUn,WaveElevFmt, IOSTAT=ErrStatTmp ) xpos, ypos, WaveElev
end do
diff --git a/modules/seastate/src/SeaState_Input.f90 b/modules/seastate/src/SeaState_Input.f90
index 46ef2092d0..a3c27756a4 100644
--- a/modules/seastate/src/SeaState_Input.f90
+++ b/modules/seastate/src/SeaState_Input.f90
@@ -54,9 +54,10 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
real(ReKi), allocatable :: tmpReArray(:) ! Temporary array storage of the joint output list
character(1) :: Line1 ! The first character of an input line
integer(IntKi) :: CurLine !< Current entry in FileInfo_In%Lines array
+ integer(IntKi) :: IOS
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
- character(*), parameter :: RoutineName = 'SeaSt_ParaseInput'
+ character(*), parameter :: RoutineName = 'SeaSt_ParseInput'
! Initialize local data
UnEc = -1
@@ -95,11 +96,11 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
CurLine = CurLine + 1
! WtrDens - Water density.
- call ParseVarWDefault ( FileInfo_In, CurLine, 'WtrDens', InputFileData%Waves%WtrDens, defWtrDens, ErrStat2, ErrMsg2, UnEc )
+ call ParseVarWDefault ( FileInfo_In, CurLine, 'WtrDens', InputFileData%WtrDens, defWtrDens, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WtrDpth - Water depth
- call ParseVarWDefault ( FileInfo_In, CurLine, 'WtrDpth', InputFileData%Waves%WtrDpth, defWtrDpth, ErrStat2, ErrMsg2, UnEc )
+ call ParseVarWDefault ( FileInfo_In, CurLine, 'WtrDpth', InputFileData%WtrDpth, defWtrDpth, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! MSL2SWL
@@ -121,7 +122,7 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
if (Failed()) return;
! Z_Depth - Depth of the domain the Z direction.
- call ParseVarWDefault ( FileInfo_In, CurLine, 'Z_Depth', InputFileData%Z_Depth, defWtrDpth+InputFileData%MSL2SWL, ErrStat2, ErrMsg2, UnEc )
+ call ParseVarWDefault ( FileInfo_In, CurLine, 'Z_Depth', InputFileData%Z_Depth, InputFileData%WtrDpth+InputFileData%MSL2SWL, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! NX - Number of nodes in half of the X-direction domain.
@@ -142,18 +143,35 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
if ( InputFileData%Echo ) write(UnEc, '(A)') trim(FileInfo_In%Lines(CurLine)) ! Write section break to echo
CurLine = CurLine + 1
- ! WaveMod - Wave kinematics model switch.
- call ParseVar( FileInfo_In, CurLine, 'WaveMod', InputFileData%Waves%WaveModChr, ErrStat2, ErrMsg2, UnEc )
- if (Failed()) return;
+ ! WaveMod - Wave kinematics model switch. and WavePhase (as appropriate)
+ InputFileData%Waves%WavePhase = 0.0
+ call ParseVar( FileInfo_In, CurLine, 'WaveMod', InputFileData%WaveMod, ErrStat2, ErrMsg2, UnEc )
+ if ( ErrStat2 >= AbortErrLev ) then
+ ! try to read the line that just failed, as a string this time to see if it's "1P"
+ call ParseVar( FileInfo_In, CurLine, 'WaveMod', Line, ErrStat2, ErrMsg2, UnEc )
+ if (Failed()) return
+
+ call Conv2UC( Line ) ! Convert Line to upper case.
+ if ( Line(1:2) == '1P' ) then ! The user wants to specify the phase in place of a random phase
- call Conv2UC( InputFileData%Waves%WaveModChr ) ! Convert Line to upper case.
+ InputFileData%WaveMod = WaveMod_RegularUsrPh ! Internally define WaveMod = 10 to mean regular waves with a specified (nonrandom) phase
+
+ read (Line(3:),*,IOSTAT=IOS ) InputFileData%Waves%WavePhase
+ call CheckIOS ( IOS, "", 'WavePhase', NumType, ErrStat2, ErrMsg2 )
+ if (Failed()) return
- InputFileData%Waves%WavePhase = 0.0
- InputFileData%Waves%WaveNDAmp = .FALSE.
+ InputFileData%Waves%WavePhase = InputFileData%Waves%WavePhase*D2R ! Convert the phase from degrees to radians
+ else ! The user must have specified WaveMod incorrectly.
+ ErrStat2 = ErrID_Fatal
+ ErrMsg2 = 'WaveMod incorrectly specified in SeaState input file.'
+ if (Failed()) return
+ end if
+
+ end if
! WaveStMod - Model switch for stretching incident wave kinematics to instantaneous free surface.
- call ParseVar( FileInfo_In, CurLine, 'WaveStMod', InputFileData%Waves%WaveStMod, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WaveStMod', InputFileData%WaveStMod, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WaveTMax - Analysis time for incident wave calculations.
@@ -173,23 +191,25 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
if (Failed()) return;
! WavePkShp - Peak shape parameter.
- call ParseVar( FileInfo_In, CurLine, 'WavePkShp', InputFileData%Waves%WavePkShpChr, ErrStat2, ErrMsg2, UnEc )
+ call ParseVarWDefault(FileInfo_In, CurLine, 'WavePkShp', InputFileData%Waves%WavePkShp, &
+ WavePkShpDefault( InputFileData%WaveMod, InputFileData%Waves%WaveHs, InputFileData%Waves%WaveTp), ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
+
! WvLowCOff - Low Cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed (rad/s).
- call ParseVar( FileInfo_In, CurLine, 'WvLowCOff', InputFileData%Waves%WvLowCOff, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvLowCOff', InputFileData%WvLowCOff, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WvHiCOff - High Cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed (rad/s).
- call ParseVar( FileInfo_In, CurLine, 'WvHiCOff', InputFileData%Waves%WvHiCOff, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvHiCOff', InputFileData%WvHiCOff, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WaveDir - Mean wave heading direction.
- call ParseVar( FileInfo_In, CurLine, 'WaveDir', InputFileData%Waves%WaveDir, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WaveDir', InputFileData%WaveDir, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WaveDirMod - Directional spreading function {0: None, 1: COS2S} (-) [Used only if WaveMod=2]
- call ParseVar( FileInfo_In, CurLine, 'WaveDirMod', InputFileData%Waves%WaveDirMod, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WaveDirMod', InputFileData%WaveDirMod, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WaveDirSpread - Spreading coefficient [only used if WaveMod=2 and WaveDirMod=1]
@@ -209,9 +229,8 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
! WaveSeed(1)
- call ParseVar( FileInfo_In, CurLine, 'WaveSeed(1)', InputFileData%Waves%WaveSeed(1), ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WaveSeed(1)', InputFileData%Waves%RNG%RandSeed(1), ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
- InputFileData%Waves%RNG%RandSeed(1) = InputFileData%Waves%WaveSeed(1)
!WaveSeed(2)
call ParseVar( FileInfo_In, CurLine, 'WaveSeed(2)', Line, ErrStat2, ErrMsg2, UnEc ) ! Read into a string and then parse
@@ -225,14 +244,11 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
if (Failed()) return;
endif
- read (Line,*,IOSTAT=ErrStat2) InputFileData%Waves%WaveSeed(2)
+ read (Line,*,IOSTAT=ErrStat2) InputFileData%Waves%RNG%RandSeed(2)
if (ErrStat2 == 0) then ! the user entered a number
- InputFileData%Waves%RNG%RandSeed(2) = InputFileData%Waves%WaveSeed(2)
-
InputFileData%Waves%RNG%RNG_type = "NORMAL"
InputFileData%Waves%RNG%pRNG = pRNG_INTRINSIC
-
else
InputFileData%Waves%RNG%RandSeed(2) = 0
@@ -273,19 +289,19 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
if (Failed()) return;
! WvLowCOffD -- Minimum frequency used in the difference methods (rad/s) [Only used if DiffQTF /= 0]
- call ParseVar( FileInfo_In, CurLine, 'WvLowCOffD', InputFileData%Waves2%WvLowCOffD, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvLowCOffD', InputFileData%WvLowCOffD, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WvHiCOffD -- Maximum frequency used in the difference methods (rad/s) [Only used if DiffQTF /= 0]
- call ParseVar( FileInfo_In, CurLine, 'WvHiCOffD', InputFileData%Waves2%WvHiCOffD, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvHiCOffD', InputFileData%WvHiCOffD, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WvLowCOffS -- Minimum frequency used in the sum-QTF (rad/s) [Only used if SumQTF /= 0]
- call ParseVar( FileInfo_In, CurLine, 'WvLowCOffS', InputFileData%Waves2%WvLowCOffS, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvLowCOffS', InputFileData%WvLowCOffS, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
! WvHiCOffS -- Maximum frequency used in the sum-QTF (rad/s) [Only used if SumQTF /= 0]
- call ParseVar( FileInfo_In, CurLine, 'WvHiCOffS', InputFileData%Waves2%WvHiCOffS, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'WvHiCOffS', InputFileData%WvHiCOffS, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
!-------------------------------------------------------------------------------------------------
@@ -297,20 +313,11 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
! ConstWaveMod - Constrained wave model switch.
call ParseVar( FileInfo_In, CurLine, 'ConstWaveMod', InputFileData%Waves%ConstWaveMod, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
- IF ( ( InputFileData%Waves%ConstWaveMod /= 0 ) .AND. ( InputFileData%Waves%ConstWaveMod /= 1 ) .AND. &
- ( InputFileData%Waves%ConstWaveMod /= 2 ) ) THEN
- call SetErrStat( ErrID_Fatal,'ConstWaveMod must be 0, 1, or 2.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
+
! CrestHmax - Crest height
call ParseVar( FileInfo_In, CurLine, 'CrestHmax', InputFileData%Waves%CrestHmax, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
- IF ( (InputFileData%Waves%WaveModChr == '2') .AND. ( InputFileData%Waves%ConstWaveMod>0 ) .AND. &
- ( InputFileData%Waves%CrestHmax < InputFileData%Waves%WaveHs ) ) THEN
- call SetErrStat( ErrID_Fatal,'CrestHmax must be larger than WaveHs.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
! CrestTime -Time of the crest
call ParseVar( FileInfo_In, CurLine, 'CrestTime', InputFileData%Waves%CrestTime, ErrStat2, ErrMsg2, UnEc )
@@ -373,15 +380,9 @@ subroutine SeaSt_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDpth,
CurLine = CurLine + 1
! MacCamy-Fuchs member radius
- call ParseVar( FileInfo_In, CurLine, 'MCFD', InputFileData%Waves%MCFD, ErrStat2, ErrMsg2, UnEc )
+ call ParseVar( FileInfo_In, CurLine, 'MCFD', InputFileData%MCFD, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;
- IF ( InputFileData%Waves%WaveModChr == '0' .OR. InputFileData%Waves%WaveModChr == '6' ) THEN
- IF ( InputFileData%Waves%MCFD > 0.0_SiKi ) THEN
- CALL SetErrStat( ErrID_Fatal,' The MacCamy-Fuchs diffraction model is not compatible with WaveMod = 0 or 6. Need to set MCFD to 0.',ErrStat,ErrMsg,RoutineName)
- RETURN
- END IF
- END IF
!-------------------------------------------------------------------------------------------------
! Data section for OUTPUT
@@ -516,7 +517,6 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
character(1024) :: TmpPath ! Temporary storage for relative path name
real(ReKi) :: xpos, ypos, zpos
real(SiKi) :: TmpFreq
- integer :: WaveModIn
integer(IntKi) :: ErrStat2, IOS
character(ErrMsgLen) :: ErrMsg2
@@ -524,30 +524,22 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! Initialize ErrStat
ErrStat = ErrID_None
- ErrStat2 = ErrID_None
ErrMsg = ""
- ErrMsg2 = ""
- !-------------------------------------------------------------------------
- ! Check environmental conditions
- !-------------------------------------------------------------------------
+ !-------------------------------------------------------------------------
+ ! Check environmental conditions
+ !-------------------------------------------------------------------------
! WtrDens - Water density.
-
- if ( InputFileData%Waves%WtrDens < 0.0 ) then
+ if ( InputFileData%WtrDens < 0.0 ) then
call SetErrStat( ErrID_Fatal,'WtrDens must not be negative.',ErrStat,ErrMsg,RoutineName)
return
end if
-
! WtrDpth - Water depth
-
- ! First adjust water depth based on MSL2SWL values
- InputFileData%Waves%WtrDpth = InputFileData%Waves%WtrDpth + InputFileData%MSL2SWL
-
- if ( InputFileData%Waves%WtrDpth <= 0.0 ) then
+ if ( InputFileData%WtrDpth + InputFileData%MSL2SWL <= 0.0 ) then
call SetErrStat( ErrID_Fatal,'WtrDpth + MSL2SWL must be greater than zero.',ErrStat,ErrMsg,RoutineName)
return
end if
@@ -565,8 +557,7 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
end if
! Z_Depth - Depth of the domain the Z direction (m)
-
- if ( ( InputFileData%Z_Depth <= 0.0_ReKi ) .or. ( InputFileData%Z_Depth > InputFileData%Waves%WtrDpth ) ) then
+ if ( ( InputFileData%Z_Depth <= 0.0_ReKi ) .or. ( InputFileData%Z_Depth > InputFileData%WtrDpth + InputFileData%MSL2SWL ) ) then
call SetErrStat( ErrID_Fatal,'Z_Depth must be greater than zero and less than or equal to the WtrDpth + MSL2SWL.',ErrStat,ErrMsg,RoutineName)
return
end if
@@ -589,129 +580,58 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
return
end if
-
! WaveMod - Wave kinematics model switch.
- if ( LEN_TRIM(InputFileData%Waves%WaveModChr) > 1 ) then
-
- if ( InputFileData%Waves%WaveModChr(1:2) == '1P' ) then ! The user wants to specify the phase in place of a random phase
-
- read (InputFileData%Waves%WaveModChr(3:),*,IOSTAT=IOS ) InputFileData%Waves%WavePhase
- call CheckIOS ( IOS, "", 'WavePhase', NumType, ErrStat2, ErrMsg2 )
- call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName)
- if ( ErrStat >= AbortErrLev ) return
-
- WaveModIn = 1
- InputFileData%Waves%WaveMod = 10 ! Internally define WaveMod = 10 to mean regular waves with a specified (nonrandom) phase
- InputFileData%Waves%WavePhase = InputFileData%Waves%WavePhase*D2R ! Convert the phase from degrees to radians
-
- else ! The user must have specified WaveMod incorrectly.
- call SetErrStat( ErrID_Fatal,'WaveMod incorrectly specified',ErrStat,ErrMsg,RoutineName)
- return
- end if
-
- else
- ! The line below only works for 1 digit reads
- read( InputFileData%Waves%WaveModChr, *, IOSTAT=IOS ) InputFileData%Waves%WaveMod
- call CheckIOS ( IOS, "", 'WaveMod', NumType, ErrStat2, ErrMsg2 )
- call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName)
- if ( ErrStat >= AbortErrLev ) return
-
- WaveModIn = InputFileData%Waves%WaveMod
-
- end if ! LEN_TRIM(InputFileData%Waves%WaveModChr)
-
-
- if ( WaveModIn < 0 .OR. WaveModIn > 7 ) then
+ SELECT CASE(InputFileData%WaveMod)
+ CASE(WaveMod_None)
+ CASE(WaveMod_Regular)
+ CASE(WaveMod_RegularUsrPh)
+ CASE(WaveMod_JONSWAP)
+ CASE(WaveMod_WhiteNoise)
+ CASE(WaveMod_UserSpctrm)
+ CASE(WaveMod_ExtElev)
+ CASE(WaveMod_ExtFull)
+ CASE(WaveMod_UserFreq)
+ CASE DEFAULT
call SetErrStat( ErrID_Fatal,'WaveMod must be 0, 1, 1P#, 2, 3, 4, 5, 6, or 7',ErrStat,ErrMsg,RoutineName)
return
- end if
+ END SELECT
- ! Linearization Checks
- ! LIN-TODO:
- !errors if:
- !if ( &
- ! (WaveModIn /= 0) .or. &
- ! (InputFileData%Waves2%WvDiffQTFF /= .false.) .or. &
- ! (InputFileData%Waves2%WvSumQTFF /= .false.) .or. &
- ! (InputFileData%PotMod /= 0 .or. InputFileData%PotMod /=1) .or. &
- ! (InputFileData%WAMIT%ExctnMod /=0 .or. InputFileData%WAMIT%ExctnMod /=2) .or. &
- ! (InputFileData%WAMIT%RdtnMod /=0 .or. InputFileData%WAMIT%RdtnMod /=2) .or. &
- ! (InputFileData%WAMIT2%MnDrift /=0) .or. &
- ! (InputFileData%WAMIT2%NewmanApp /= 0) .or. &
- ! (InputFileData%WAMIT2%SumQTF /= 0 ) ) then
- !
- !end if
! WaveStMod - Model switch for stretching incident wave kinematics to instantaneous free surface.
-
- ! TODO: We are only implementing WaveStMod = 0 (No stretching) at this point in time. 1 Mar 2013 GJH
- ! All three methods of wave stretching tentatively implemented.
-
- IF ( InputFileData%Waves%WaveMod /= 0 .AND. InputFileData%Waves%WaveMod /= 6 ) THEN
- IF ( (InputFileData%Waves%WaveStMod /= 0) .AND. (InputFileData%Waves%WaveStMod /= 1) .AND. &
- (InputFileData%Waves%WaveStMod /= 2) .AND. (InputFileData%Waves%WaveStMod /= 3) ) THEN
+ IF ( InputFileData%WaveMod == WaveMod_None ) THEN
+ InputFileData%WaveStMod = 0_IntKi
+ ELSEIF ( InputFileData%WaveMod == WaveMod_ExtFull ) THEN
+ IF ( (InputFileData%WaveStMod /= 0) .AND. (InputFileData%WaveStMod /= 1) .AND. &
+ (InputFileData%WaveStMod /= 3) ) THEN
+ CALL SetErrStat( ErrID_Fatal,'WaveStMod must be 0, 1, or 3 when WaveMod = 6.',ErrStat,ErrMsg,RoutineName)
+ RETURN
+ END IF
+ ELSE
+ IF ( (InputFileData%WaveStMod /= 0) .AND. (InputFileData%WaveStMod /= 1) .AND. &
+ (InputFileData%WaveStMod /= 2) .AND. (InputFileData%WaveStMod /= 3) ) THEN
CALL SetErrStat( ErrID_Fatal,'WaveStMod must be 0, 1, 2, or 3.',ErrStat,ErrMsg,RoutineName)
RETURN
END IF
- ELSE ! Wave stretching is not supported when WaveMod = 0 or 6.
- InputFileData%Waves%WaveStMod = 0_IntKi
END IF
- !if ( InputFileData%Waves%WaveMod /= 6 .AND. InputFileData%Morison%NMembers > 0 .AND. InputFileData%Waves%WaveMod > 0 ) then
- !
- ! if ( ( InputFileData%Waves%WaveStMod /= 0 ) .AND. ( InputFileData%Waves%WaveStMod /= 1 ) .AND. &
- ! ( InputFileData%Waves%WaveStMod /= 2 ) ) then ! (TODO: future version will support 3) .AND. ( InputFileData%Waves%WaveStMod /= 3 ) ) then
- ! ErrMsg = ' WaveStMod must be 0, 1, or 2.' !, or 3.'
- ! ErrStat = ErrID_Fatal
- !
- ! return
- ! end if
- !
- ! !if ( ( InputFileData%Waves%WaveStMod /= 3 ) .AND. ( InputFileData%Waves%WaveMod == 5 ) ) then
- ! ! ErrMsg = ' WaveStMod must be set to 3 when WaveMod is set to 5.'
- ! ! ErrStat = ErrID_Fatal
- ! !
- ! ! return
- ! !end if
- !
- !
- !
- !else !don't use this one
- !
- ! ! NOTE: Do not read in WaveStMod for floating platforms since it is
- ! ! inconsistent to use stretching (which is a nonlinear correction) for
- ! ! the viscous drag term in Morison's equation while not accounting for
- ! ! stretching in the diffraction and radiation problems (according to
- ! ! Paul Sclavounos, there are such corrections). Instead, the viscous
- ! ! drag term from Morison's equation is computed by integrating up to
- ! ! the MSL, regardless of the instantaneous free surface elevation.
- !
- ! InputFileData%Waves%WaveStMod = 0
- !
- !end if
-
! WaveTMax - Analysis time for incident wave calculations.
- if ( InputFileData%Waves%WaveMod == 0 ) then ! .TRUE if we have incident waves.
+ if ( InputFileData%WaveMod == WaveMod_None ) then ! .TRUE if we have incident waves.
! TODO: Issue warning if WaveTMax was not already 0.0 in this case.
! Setting WaveTMax = 0 breaks interpolation. Should probably set it to just TMax instead.
- ! if ( .NOT. EqualRealNos(InputFileData%Waves%WaveTMax, 0.0_DbKi) ) then
- ! call WrScr( ' Setting WaveTMax to 0.0 since WaveMod = 0' )
- ! InputFileData%Waves%WaveTMax = 0.0
- ! end if
if ( .NOT. EqualRealNos(InputFileData%Waves%WaveTMax, InitInp%TMax) ) then
call WrScr( ' Setting WaveTMax to TMax since WaveMod = 0' )
InputFileData%Waves%WaveTMax = InitInp%TMax
end if
- if ( .NOT. EqualRealNos(InputFileData%Waves%WaveDir, 0.0_SiKi) ) then
+ if ( .NOT. EqualRealNos(InputFileData%WaveDir, 0.0_SiKi) ) then
call WrScr( ' Setting WaveDir to 0.0 since WaveMod = 0' )
- InputFileData%Waves%WaveDir = 0.0
+ InputFileData%WaveDir = 0.0
end if
- elseif ( InputFileData%Waves%WaveMod == 5 ) then ! User wave elevation file reading in
+ elseif ( InputFileData%WaveMod == WaveMod_ExtElev ) then ! User wave elevation file reading in
if (InitInp%TMax > InputFileData%Waves%WaveTMax ) then
call SetErrstat( ErrID_Fatal, ' WaveTMax must be larger than the simulation time for user wave elevations (WaveMod == 5).',ErrStat,ErrMsg,RoutineName)
return
@@ -725,7 +645,7 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! WaveDT - Time step for incident wave calculations
- if ( InputFileData%Waves%WaveMod > 0 ) then ! .TRUE if we have incident waves.
+ if ( InputFileData%WaveMod /= WaveMod_None ) then ! .TRUE if we have incident waves.
if ( InputFileData%Waves%WaveDT <= 0.0 ) then
call SetErrStat( ErrID_Fatal,'WaveDT must be greater than zero.',ErrStat,ErrMsg,RoutineName)
@@ -743,105 +663,80 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! WaveHs - Significant wave height
-
- if ( ( InputFileData%Waves%WaveMod /= 0 ) .AND. ( InputFileData%Waves%WaveMod /= 4 ) .AND. ( InputFileData%Waves%WaveMod /= 5 ) ) then ! .TRUE. (when WaveMod = 1, 2, 3, or 10) if we have plane progressive (regular), JONSWAP/Pierson-Moskowitz spectrum (irregular) waves, or white-noise waves, but not user-defined or GH Bladed wave data.
+ if ( InputFileData%WaveMod == WaveMod_Regular .OR. &
+ InputFileData%WaveMod == WaveMod_RegularUsrPh .OR. &
+ InputFileData%WaveMod == WaveMod_JONSWAP .OR. &
+ InputFileData%WaveMod == WaveMod_WhiteNoise ) then
if ( InputFileData%Waves%WaveHs <= 0.0 ) then
call SetErrStat( ErrID_Fatal,'WaveHs must be greater than zero.',ErrStat,ErrMsg,RoutineName)
return
end if
-
- else
-
- InputFileData%Waves%WaveHs = 0.0
-
+
end if
! WaveTp - Peak spectral period.
- ! We commented out the if else block due to a bug when WaveMod == 3, and then WaveTp is hence set to 0.0. See line 1092 of Waves.f90 (as of 11/24/2014) GJH
- !if ( ( InputFileData%Waves%WaveMod == 1 ) .OR. ( InputFileData%Waves%WaveMod == 2 ) .OR. ( InputFileData%Waves%WaveMod == 10 ) ) then ! .TRUE. (when WaveMod = 1, 2, or 10) if we have plane progressive (regular), JONSWAP/Pierson-Moskowitz spectrum (irregular) waves.
-
- if ( InputFileData%Waves%WaveTp <= 0.0 ) then
- call SetErrStat( ErrID_Fatal,'WaveTp must be greater than zero.',ErrStat,ErrMsg,RoutineName)
- return
- end if
-
- ! else
-
- ! InputFileData%Waves%WaveTp = 0.0
-
- ! end if
-
-
- ! WavePkShp - Peak shape parameter.
-
- call Conv2UC( InputFileData%Waves%WavePkShpChr ) ! Convert Line to upper case.
-
- if ( InputFileData%Waves%WaveMod == 2 ) then ! .TRUE if we have JONSWAP/Pierson-Moskowitz spectrum (irregular) waves, but not GH Bladed wave data.
-
- if ( TRIM(InputFileData%Waves%WavePkShpChr) == 'DEFAULT' ) then ! .TRUE. when one wants to use the default value of the peak shape parameter, conditioned on significant wave height and peak spectral period.
-
- InputFileData%Waves%WavePkShp = WavePkShpDefault ( InputFileData%Waves%WaveHs, InputFileData%Waves%WaveTp )
-
- else ! The input must have been specified numerically.
-
- read (InputFileData%Waves%WavePkShpChr,*,IOSTAT=IOS) InputFileData%Waves%WavePkShp
- call CheckIOS ( IOS, "", 'WavePkShp', NumType, ErrStat2, ErrMsg2 )
- call SetErrStat(ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName)
- if ( ErrStat >= AbortErrLev ) return
-
- if ( ( InputFileData%Waves%WavePkShp < 1.0 ) .OR. ( InputFileData%Waves%WavePkShp > 7.0 ) ) then
- call SetErrStat( ErrID_Fatal,'WavePkShp must be greater than or equal to 1 and less than or equal to 7.',ErrStat,ErrMsg,RoutineName)
- return
- end if
-
- end if
+ if ( InputFileData%Waves%WaveTp <= 0.0 ) then
+ call SetErrStat( ErrID_Fatal,'WaveTp must be greater than zero.',ErrStat,ErrMsg,RoutineName)
+ return
+ end if
- else
- InputFileData%Waves%WavePkShp = 1.0
+ ! WavePkShp - Peak shape parameter
+ if ( ( InputFileData%Waves%WavePkShp < 1.0 ) .OR. ( InputFileData%Waves%WavePkShp > 7.0 ) ) then
+ call SetErrStat( ErrID_Fatal,'WavePkShp must be greater than or equal to 1 and less than or equal to 7.',ErrStat,ErrMsg,RoutineName)
+ return
end if
! WvLowCOff and WvHiCOff - Wave Cut-off frequency
- if ( InputFileData%Waves%WvLowCOff < 0 ) then
+ if ( InputFileData%WvLowCOff < 0 ) then
call SetErrStat( ErrID_Fatal,'WvLowCOff must be greater than or equal to zero.',ErrStat,ErrMsg,RoutineName)
return
end if
! Threshold upper cut-off based on sampling rate
if ( EqualRealNos(InputFileData%Waves%WaveDT, 0.0_DbKi) ) then
- InputFileData%Waves%WvHiCOff = 10000.0; ! This is not going to be used because WaveDT is zero.
+ InputFileData%WvHiCOff = 10000.0; ! This is not going to be used because WaveDT is zero.
else
TmpFreq = REAL( Pi/InputFileData%Waves%WaveDT,SiKi)
- if ( InputFileData%Waves%WvHiCOff > TmpFreq ) then
- InputFileData%Waves%WvHiCOff = TmpFreq
- call SetErrStat( ErrID_Info,'WvLowCOff adjusted to '//trim(num2lstr(TmpFreq))//' rad/s, based on WaveDT.',ErrStat,ErrMsg,RoutineName)
+ if ( InputFileData%WvHiCOff > TmpFreq ) then
+ InputFileData%WvHiCOff = TmpFreq
+ call SetErrStat( ErrID_Info,'WvHiCOff adjusted to '//trim(num2lstr(TmpFreq))//' rad/s, based on WaveDT.',ErrStat,ErrMsg,RoutineName)
end if
end if
- if (InputFileData%Waves%WaveMod > 2 .and. InputFileData%Waves%WaveMod /= 6) then
- if ( InputFileData%Waves%WvLowCOff >= InputFileData%Waves%WvHiCOff ) then
+ if (InputFileData%WaveMod == WaveMod_JONSWAP .or. &
+ InputFileData%WaveMod == WaveMod_WhiteNoise .or. &
+ InputFileData%WaveMod == WaveMod_UserSpctrm .or. &
+ InputFileData%WaveMod == WaveMod_ExtElev .or. &
+ InputFileData%WaveMod == WaveMod_UserFreq ) then
+
+ if ( InputFileData%WvLowCOff >= InputFileData%WvHiCOff ) then
call SetErrSTat( ErrID_Fatal,'WvLowCOff must be less than WvHiCOff.',ErrStat,ErrMsg,RoutineName)
return
end if
+ else
+ ! overwrite these so that ALL frequencies are allowed (otherwise we might exclude frequencies with WaveMod = WaveMod_Regular or WaveMod_RegularUsrPh)
+ InputFileData%WvLowCOff = -HUGE(InputFileData%WvLowCOff)
+ InputFileData%WvHiCOff = HUGE(InputFileData%WvHiCOff )
end if
! WaveDir - Wave heading direction.
- if ( ( InputFileData%Waves%WaveMod > 0 ) .AND. ( InputFileData%Waves%WaveMod /= 6 ) ) then ! .TRUE if we have incident waves, but not user input wave data.
+ if ( ( InputFileData%WaveMod /= WaveMod_None ) .AND. ( InputFileData%WaveMod /= WaveMod_ExtFull ) ) then ! .TRUE if we have incident waves, but not user input wave data.
- if ( ( InputFileData%Waves%WaveDir <= -180.0 ) .OR. ( InputFileData%Waves%WaveDir > 180.0 ) ) then
+ if ( ( InputFileData%WaveDir <= -180.0 ) .OR. ( InputFileData%WaveDir > 180.0 ) ) then
call SetErrStat( ErrID_Fatal,'WaveDir must be greater than -180 and less than or equal to 180.',ErrStat,ErrMsg,RoutineName)
return
end if
else
- InputFileData%Waves%WaveDir = 0.0
+ InputFileData%WaveDir = 0.0
end if
@@ -849,32 +744,34 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! Multi-directional waves
! Check the WaveDirMod value
- if ( InputFileData%Waves%WaveDirMod < 0 .OR. InputFileData%Waves%WaveDirMod > 1 ) then
+ if ( InputFileData%WaveDirMod /= WaveDirMod_None .AND. InputFileData%WaveDirMod /= WaveDirMod_COS2S ) then
call SetErrStat( ErrID_Fatal,'WaveDirMod must be either 0 (No spreading) or 1 (COS2S spreading function)',ErrStat,ErrMsg,RoutineName)
return
end if
! Check if we are doing multidirectional waves or not.
! We can only use multi directional waves on WaveMod=2,3,4
- InputFileData%Waves%WaveMultiDir = .FALSE. ! Set flag to false to start
- if ( InputFileData%Waves%WaveMod >= 2 .AND. InputFileData%Waves%WaveMod <= 4 .AND. InputFileData%Waves%WaveDirMod == 1 ) then
- InputFileData%Waves%WaveMultiDir = .TRUE.
- elseif ( (InputFileData%Waves%WaveMod < 2 .OR. InputFileData%Waves%WaveMod >4) .AND. InputFileData%Waves%WaveDirMod == 1 ) then
- call SetErrStat( ErrID_Warn,'WaveDirMod unused unless WaveMod == 2, 3, or 4. Ignoring WaveDirMod.',ErrStat,ErrMsg,RoutineName)
+ InputFileData%WaveMultiDir = .FALSE. ! Set flag to false to start
+ IF (InputFileData%WaveDirMod == WaveDirMod_COS2S ) THEN
+ if ( InputFileData%WaveMod == WaveMod_JONSWAP .OR. InputFileData%WaveMod == WaveMod_WhiteNoise .OR. InputFileData%WaveMod == WaveMod_UserSpctrm ) then
+ InputFileData%WaveMultiDir = .TRUE.
+ else
+ call SetErrStat( ErrID_Warn,'WaveDirMod unused unless WaveMod == 2, 3, or 4. Ignoring WaveDirMod.',ErrStat,ErrMsg,RoutineName)
+ end if
ENDIF
! Check to see if the for some reason the wave direction spreading range is set to zero. If it is,
! we don't have any spreading, so we will turn off the multidirectional waves.
- if ( InputFileData%Waves%WaveMultiDir .AND. EqualRealNos( InputFileData%Waves%WaveDirRange, 0.0_SiKi ) ) then
+ if ( InputFileData%WaveMultiDir .AND. EqualRealNos( InputFileData%Waves%WaveDirRange, 0.0_SiKi ) ) then
call SetErrStat( ErrID_Warn,' WaveDirRange set to zero, so multidirectional waves are turned off.',ErrStat,ErrMsg,RoutineName)
- InputFileData%Waves%WaveMultiDir = .FALSE.
+ InputFileData%WaveMultiDir = .FALSE.
ENDIF
! We check the following only if we set WaveMultiDir to true, otherwise ignore them and set them to zero
- if ( InputFileData%Waves%WaveMultiDir ) then
+ if ( InputFileData%WaveMultiDir ) then
! Check WaveDirSpread
if ( InputFileData%Waves%WaveDirSpread <= 0.0 ) then
@@ -913,22 +810,9 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
end if
- ! WaveSeed(1), !WaveSeed(2)
-
- if ( .NOT. ( ( InputFileData%Waves%WaveMod > 0 ) .AND. ( InputFileData%Waves%WaveMod /= 5 ) .AND. ( InputFileData%Waves%WaveMod /= 10 ) ) ) then !.TRUE. for plane progressive (regular) with random phase or irregular wave
-
- DO I = 1,2
-
- InputFileData%Waves%WaveSeed(I) = 0
-
- end DO !I
-
- end if
-
-
! WvKinFile
- if ( InputFileData%Waves%WaveMod == 5 .OR. InputFileData%Waves%WaveMod == 6 .OR. InputFileData%Waves%WaveMod == 7) then ! .TRUE if we are to read user-supplied wave elevation or wave kinematics file(s).
+ if ( InputFileData%WaveMod == WaveMod_ExtElev .OR. InputFileData%WaveMod == WaveMod_ExtFull .OR. InputFileData%WaveMod == WaveMod_UserFreq) then ! .TRUE if we are to read user-supplied wave elevation or wave kinematics file(s).
if ( LEN_TRIM( InputFileData%Waves%WvKinFile ) == 0 ) then
call SetErrStat( ErrID_Fatal,'WvKinFile must not be an empty string.',ErrStat,ErrMsg,RoutineName)
@@ -951,13 +835,13 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! Difference frequency cutoffs
! WvLowCOffD and WvHiCOffD - Wave Cut-off frequency
- if ( InputFileData%Waves2%WvLowCOffD < 0 ) then
+ if ( InputFileData%WvLowCOffD < 0 ) then
call SetErrStat( ErrID_Fatal,'WvLowCOffD must be greater than or equal to zero.',ErrStat,ErrMsg,RoutineName)
return
end if
! Check that the order given makes sense.
- if ( InputFileData%Waves2%WvLowCOffD >= InputFileData%Waves2%WvHiCOffD ) then
+ if ( InputFileData%WvLowCOffD >= InputFileData%WvHiCOffD ) then
call SetErrStat( ErrID_Fatal,'WvLowCOffD must be less than WvHiCOffD.',ErrStat,ErrMsg,RoutineName)
return
end if
@@ -966,17 +850,35 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! Sum frequency cutoffs
! WvLowCOffS and WvHiCOffD - Wave Cut-off frequency
- if ( InputFileData%Waves2%WvLowCOffS < 0 ) then
+ if ( InputFileData%WvLowCOffS < 0 ) then
call SetErrStat( ErrID_Fatal,'WvLowCOffS must be greater than or equal to zero.',ErrStat,ErrMsg,RoutineName)
return
end if
! Check that the order given makes sense.
- if ( InputFileData%Waves2%WvLowCOffS >= InputFileData%Waves2%WvHiCOffS ) then
+ if ( InputFileData%WvLowCOffS >= InputFileData%WvHiCOffS ) then
call SetErrStat( ErrID_Fatal,'WvLowCOffS must be less than WvHiCOffS.',ErrStat,ErrMsg,RoutineName)
return
end if
+ !-------------------------------------------------------------------------
+ ! Check Constrained Waves section
+ !-------------------------------------------------------------------------
+
+ ! ConstWaveMod
+ IF ( ( InputFileData%Waves%ConstWaveMod /= 0 ) .AND. ( InputFileData%Waves%ConstWaveMod /= 1 ) .AND. &
+ ( InputFileData%Waves%ConstWaveMod /= 2 ) ) THEN
+ call SetErrStat( ErrID_Fatal,'ConstWaveMod must be 0, 1, or 2.',ErrStat,ErrMsg,RoutineName)
+ RETURN
+ END IF
+
+ ! CrestHmax
+ IF ( ( InputFileData%WaveMod == WaveMod_JONSWAP ) .AND. ( InputFileData%Waves%ConstWaveMod>0 ) .AND. &
+ ( InputFileData%Waves%CrestHmax < InputFileData%Waves%WaveHs ) ) THEN
+ call SetErrStat( ErrID_Fatal,'CrestHmax must be larger than WaveHs.',ErrStat,ErrMsg,RoutineName)
+ RETURN
+ END IF
+
!-------------------------------------------------------------------------
! Check Current section
!-------------------------------------------------------------------------
@@ -989,7 +891,7 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
return
end if
- if ( ( InputFileData%Current%CurrMod /= 0 ) .AND. ( InputFileData%Waves%WaveMod == 6 ) ) then
+ if ( ( InputFileData%Current%CurrMod /= 0 ) .AND. ( InputFileData%WaveMod == WaveMod_ExtFull ) ) then
call SetErrStat( ErrID_Fatal,'CurrMod must be set to 0 when WaveMod is set to 6: user-input wave data.',ErrStat,ErrMsg,RoutineName)
return
end if
@@ -1018,12 +920,12 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
if ( TRIM(InputFileData%Current%CurrSSDirChr) == 'DEFAULT' ) then ! .TRUE. when one wants to use the default value of codirectionality between sub-surface current and incident wave propogation heading directions.
- if ( InputFileData%Waves%WaveMod == 0 ) then
+ if ( InputFileData%WaveMod == WaveMod_None ) then
call SetErrStat( ErrID_Fatal,'CurrSSDir must not be set to ''DEFAULT'' when WaveMod is set to 0.',ErrStat,ErrMsg,RoutineName)
return
end if
- InputFileData%Current%CurrSSDir = InputFileData%Waves%WaveDir
+ InputFileData%Current%CurrSSDir = InputFileData%WaveDir
else ! The input must have been specified numerically.
@@ -1127,6 +1029,15 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
end if
+ !-------------------------------------------------------------------------------------------------
+ ! Data section for MacCamy-Fuchs diffraction model
+ !-------------------------------------------------------------------------------------------------
+ IF ( InputFileData%WaveMod == WaveMod_None .OR. InputFileData%WaveMod == WaveMod_ExtFull ) THEN
+ IF ( InputFileData%MCFD > 0.0_SiKi ) THEN
+ CALL SetErrStat( ErrID_Fatal,' The MacCamy-Fuchs diffraction model is not compatible with WaveMod = 0 or 6. Need to set MCFD to 0.',ErrStat,ErrMsg,RoutineName)
+ RETURN
+ END IF
+ END IF
!-------------------------------------------------------------------------------------------------
! Data section for OUTPUT
@@ -1153,7 +1064,7 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! Current
! For wave kinematic calculations, the effective water depth is the user input water depth (positive valued) + MSL2SWL (positive when SWL is above MSL).
- InputFileData%Current%WtrDpth = InputFileData%Waves%WtrDpth ! already adjusted for the MSL2SWL.
+ InputFileData%Current%EffWtrDpth = InputFileData%WtrDpth + InputFileData%MSL2SWL ! adjusted for the MSL2SWL.
! Waves
@@ -1191,9 +1102,6 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
if ( ErrStat >= AbortErrLev ) return
! Generate grid points
- p%X_HalfWidth = InputFileData%X_HalfWidth
- p%Y_HalfWidth = InputFileData%Y_HalfWidth
- p%Z_Depth = InputFileData%Z_Depth
p%deltaGrid(1) = InputFileData%X_HalfWidth/(InputFileData%NX-1)
p%deltaGrid(2)= InputFileData%Y_HalfWidth/(InputFileData%NY-1)
p%deltaGrid(3) = PI / ( 2*(InputFileData%NZ-1) )
@@ -1224,10 +1132,7 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
! If we are using the Waves module, the node information must be copied over.
InputFileData%Waves2%NWaveKinGrid = InputFileData%Waves%NWaveKinGrid ! Number of points where the incident wave kinematics will be computed (-)
if ( InputFileData%Waves2%WvDiffQTFF .OR. InputFileData%Waves2%WvSumQTFF ) then
- InputFileData%Waves2%WtrDens = InputFileData%Waves%WtrDens
InputFileData%Waves2%Gravity = InitInp%Gravity
- InputFileData%Waves2%WtrDpth = InputFileData%Waves%WtrDpth
- InputFileData%Waves2%WaveStMod = InputFileData%Waves%WaveStMod
InputFileData%Waves2%NGrid = p%NGrid
InputFileData%Waves2%NWaveElevGrid = InputFileData%Waves%NWaveElevGrid
@@ -1241,6 +1146,37 @@ subroutine SeaStateInput_ProcessInitData( InitInp, p, InputFileData, ErrStat, Er
InputFileData%Waves2%WaveKinGridzi = InputFileData%Waves%WaveKinGridzi
ENDIF
+
+ !------------------------------------------------------------
+ ! Allocate the WaveFieldType to store wave field information
+ !------------------------------------------------------------
+ ALLOCATE(p%WaveField, STAT=ErrStat2)
+ IF (ErrStat2 /=0) THEN
+ CALL SetErrStat(ErrID_Fatal,"Error allocating WaveField.",ErrStat,ErrMsg,RoutineName)
+ RETURN
+ END IF
+
+ p%WaveField%WtrDpth = InputFileData%WtrDpth
+ p%WaveField%MSL2SWL = InputFileData%MSL2SWL
+ p%WaveField%EffWtrDpth = InputFileData%WtrDpth + InputFileData%MSL2SWL
+
+ p%WaveField%WaveMod = InputFileData%WaveMod
+ p%WaveField%WaveStMod = InputFileData%WaveStMod
+ p%WaveField%WtrDens = InputFileData%WtrDens ! may have overwritten default InitInp
+ p%WaveField%RhoXg = p%WaveField%WtrDens*InitInp%Gravity ! For WAMIT and WAMIT2
+ p%WaveField%WaveDir = InputFileData%WaveDir
+ p%WaveField%WaveMultiDir = InputFileData%WaveMultiDir
+ p%WaveField%MCFD = InputFileData%MCFD
+
+ p%WaveField%WvLowCOff = InputFileData%WvLowCOff
+ p%WaveField%WvHiCOff = InputFileData%WvHiCOff
+ p%WaveField%WvLowCOffD = InputFileData%WvLowCOffD
+ p%WaveField%WvHiCOffD = InputFileData%WvHiCOffD
+ p%WaveField%WvLowCOffS = InputFileData%WvLowCOffS
+ p%WaveField%WvHiCOffS = InputFileData%WvHiCOffS
+ p%WaveField%WaveDOmega = InputFileData%WaveDOmega ! For WAMIT and WAMIT2, FIT
+
+
end subroutine SeaStateInput_ProcessInitData
end module SeaState_Input
diff --git a/modules/seastate/src/SeaState_Interp.f90 b/modules/seastate/src/SeaState_Interp.f90
index 1b921bc40d..143ad80180 100644
--- a/modules/seastate/src/SeaState_Interp.f90
+++ b/modules/seastate/src/SeaState_Interp.f90
@@ -408,7 +408,7 @@ FUNCTION SeaSt_Interp_4D_Vec( pKinXX, m, ErrStat, ErrMsg )
! I/O variables
real(SiKi), intent(in ) :: pKinXX(0:,:,:,:,:)
- TYPE(SeaSt_Interp_MiscVarType), INTENT(IN ) :: m !< Parameters
+ TYPE(SeaSt_Interp_MiscVarType), INTENT(IN ) :: m !< misc vars for interpolation
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
diff --git a/modules/seastate/src/SeaState_Interp.txt b/modules/seastate/src/SeaState_Interp.txt
index 43b005aa88..5f12cd5a6a 100644
--- a/modules/seastate/src/SeaState_Interp.txt
+++ b/modules/seastate/src/SeaState_Interp.txt
@@ -12,10 +12,10 @@ include Registry_NWTC_Library.txt
#########################
-typedef SeaState_Interp/SeaSt_Interp InitInputType IntKi n 4 - - "number of grid points in the t, x, y, and z directions" -
-typedef ^ InitInputType ReKi delta 4 - - "size between 2 consecutive grid points in each grid direction (time, x, y, z)" "s,m,m,m"
-typedef ^ InitInputType ReKi pZero 4 - - "fixed position of the time-X-Y-Z grid (i.e., XYZ coordinates of m%V(:,1,1,1,:))" "m"
-typedef ^ InitInputType ReKi Z_Depth - - - "grid depth" m
+typedef SeaState_Interp/SeaSt_Interp InitInputType IntKi n 4 - - "number of grid points in the t, x, y, and z directions" -
+typedef ^ InitInputType ReKi delta 4 - - "size between 2 consecutive grid points in each grid direction (time, x, y, z)" "s,m,m,m"
+typedef ^ InitInputType ReKi pZero 4 - - "fixed position of the time-X-Y-Z grid (i.e., XYZ coordinates of m%V(:,1,1,1,:))" "m"
+typedef ^ InitInputType ReKi Z_Depth - - - "grid depth" m
# Init Output
typedef ^ InitOutputType ProgDesc Ver - - - "Version information of this submodule" -
@@ -24,19 +24,19 @@ typedef ^ InitOutputType ProgDesc Ver -
# ..... Misc/Optimization variables.................................................................................................
# 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 SiKi N3D {8} - - "this is the 3-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field" -
-typedef ^ MiscVarType SiKi N4D {16} - - "this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field" -
-typedef ^ MiscVarType integer Indx_Lo 4 - - "this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field" -
-typedef ^ MiscVarType integer Indx_Hi 4 - - "this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field" -
-typedef ^ MiscVarType logical FirstWarn_Clamp - .true. - "used to avoid too many 'Position has been clamped to the grid boundary' warning messages " -
+typedef ^ MiscVarType SiKi N3D {8} - - "this is the weighting function for 3-d velocity field" -
+typedef ^ MiscVarType SiKi N4D {16} - - "this is the weighting function for 4-d velocity field" -
+typedef ^ MiscVarType integer Indx_Lo 4 - - "this is the index into the 4-d velocity field for each wave component" -
+typedef ^ MiscVarType integer Indx_Hi 4 - - "this is the index into the 4-d velocity field for each wave component" -
+typedef ^ MiscVarType logical FirstWarn_Clamp - .true. - "used to avoid too many 'Position has been clamped to the grid boundary' warning messages " -
# ..... Parameters ................................................................................................................
# Define parameters here:
# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states:
-typedef ^ ParameterType IntKi n 4 - - "number of evenly-spaced grid points in the t, x, y, and z directions" -
-typedef ^ ParameterType ReKi delta 4 - - "size between 2 consecutive grid points in each grid direction" "s,m,m,m"
-typedef ^ ParameterType ReKi pZero 4 - - "fixed position of the XYZ grid (i.e., XYZ coordinates of m%V(:,1,1,1,:))" "m"
-typedef ^ ParameterType ReKi Z_Depth - - - "grid depth" m
+typedef ^ ParameterType IntKi n 4 - - "number of evenly-spaced grid points in the t, x, y, and z directions" -
+typedef ^ ParameterType ReKi delta 4 - - "size between 2 consecutive grid points in each grid direction" "s,m,m,m"
+typedef ^ ParameterType ReKi pZero 4 - - "fixed position of the XYZ grid (i.e., XYZ coordinates of m%V(:,1,1,1,:))" "m"
+typedef ^ ParameterType ReKi Z_Depth - - - "grid depth" m
diff --git a/modules/seastate/src/SeaState_Interp_Types.f90 b/modules/seastate/src/SeaState_Interp_Types.f90
index bc0ca2fcfd..e02fbe8fc2 100644
--- a/modules/seastate/src/SeaState_Interp_Types.f90
+++ b/modules/seastate/src/SeaState_Interp_Types.f90
@@ -48,10 +48,10 @@ MODULE SeaState_Interp_Types
! =======================
! ========= SeaSt_Interp_MiscVarType =======
TYPE, PUBLIC :: SeaSt_Interp_MiscVarType
- REAL(SiKi) , DIMENSION(1:8) :: N3D = 0.0_R4Ki !< this is the 3-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field [-]
- REAL(SiKi) , DIMENSION(1:16) :: N4D = 0.0_R4Ki !< this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field [-]
- INTEGER(IntKi) , DIMENSION(1:4) :: Indx_Lo = 0_IntKi !< this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field [-]
- INTEGER(IntKi) , DIMENSION(1:4) :: Indx_Hi = 0_IntKi !< this is the 4-d velocity field for each wind component [{uvw},nx,ny,nz,nt]; it is stored as a miscVar instead of an input so that we don't have 4 copies of a very large field [-]
+ REAL(SiKi) , DIMENSION(1:8) :: N3D = 0.0_R4Ki !< this is the weighting function for 3-d velocity field [-]
+ REAL(SiKi) , DIMENSION(1:16) :: N4D = 0.0_R4Ki !< this is the weighting function for 4-d velocity field [-]
+ INTEGER(IntKi) , DIMENSION(1:4) :: Indx_Lo = 0_IntKi !< this is the index into the 4-d velocity field for each wave component [-]
+ INTEGER(IntKi) , DIMENSION(1:4) :: Indx_Hi = 0_IntKi !< this is the index into the 4-d velocity field for each wave component [-]
LOGICAL :: FirstWarn_Clamp = .true. !< used to avoid too many 'Position has been clamped to the grid boundary' warning messages [-]
END TYPE SeaSt_Interp_MiscVarType
! =======================
diff --git a/modules/seastate/src/SeaState_Output.f90 b/modules/seastate/src/SeaState_Output.f90
index 79bc15c467..b18e2c2726 100644
--- a/modules/seastate/src/SeaState_Output.f90
+++ b/modules/seastate/src/SeaState_Output.f90
@@ -232,25 +232,18 @@ MODULE SeaState_Output
CONTAINS
!====================================================================================================
-SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, NStepWave, WaveDT, X_HalfWidth, Y_HalfWidth, &
- Z_Depth, deltaGrid, NGrid, WaveElev1, WaveElev2, &
- WaveVel, WaveAcc, WaveDynP, ErrStat, ErrMsg )
+SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, WaveField, WaveDT, X_HalfWidth, Y_HalfWidth, &
+ deltaGrid, NGrid, ErrStat, ErrMsg )
! Passed variables
CHARACTER(*), INTENT( IN ) :: Rootname ! filename including full path, minus any file extension.
TYPE(ProgDesc), INTENT( IN ) :: SeaSt_Prog ! the name/version/date of the SeaState program
- INTEGER, INTENT( IN ) :: NStepWave ! Number of time steps for the wave kinematics arrays
+ TYPE(SeaSt_WaveFieldType), INTENT( IN ) :: WaveField !< WaveFieldType
real(DbKi), intent( in ) :: WaveDT
real(ReKi), intent( in ) :: X_HalfWidth
real(ReKi), intent( in ) :: Y_HalfWidth
- real(ReKi), intent( in ) :: Z_Depth
real(ReKi), intent( in ) :: deltaGrid(3)
INTEGER, INTENT( IN ) :: NGrid(3) ! Number of grid points for the wave kinematics arrays
- REAL(SiKi), pointer, INTENT( IN ) :: WaveElev1 (:,:,: ) ! Instantaneous wave elevations at requested locations - 1st order
- REAL(SiKi), pointer, INTENT( IN ) :: WaveElev2 (:,:,: ) ! Instantaneous wave elevations at requested locations - 2nd order
- REAL(SiKi), pointer, INTENT( IN ) :: WaveVel (:,:,:,:,:) ! The wave velocities (time,node,component)
- REAL(SiKi), pointer, INTENT( IN ) :: WaveAcc (:,:,:,:,:) ! The wave accelerations (time,node,component)
- REAL(SiKi), pointer, INTENT( IN ) :: WaveDynP(:,:,:,:) ! The wave dynamic pressure (time,node)
INTEGER, INTENT( OUT ) :: ErrStat ! returns a non-zero value when an error occurs
CHARACTER(*), INTENT( OUT ) :: ErrMsg ! Error message if ErrStat /= ErrID_None
@@ -280,7 +273,7 @@ SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, NStepWave, WaveDT, X_
y_gridPts(i+1) = -Y_HalfWidth + deltaGrid(2)*i
end do
do i = 0, NGrid(3)-1
- z_gridPts(i+1) = - ( 1.0 - cos( real((NGrid(3) - 1) - i, ReKi) * deltaGrid(3) ) ) * Z_Depth
+ z_gridPts(i+1) = - ( 1.0 - cos( real((NGrid(3) - 1) - i, ReKi) * deltaGrid(3) ) ) * WaveField%SeaSt_Interp_p%Z_Depth
end do
! Write the increments from [0, NStepWave] even though for OpenFAST data, NStepWave = 0, but for arbitrary user data this may not be true.
@@ -296,7 +289,7 @@ SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, NStepWave, WaveDT, X_
call WriteWvKinHeader( UnWv, iFile, Delim, SeaSt_Prog, waveDT, -z_gridPts(1), NGrid, deltaGrid )
- DO m= 0,NStepWave
+ DO m= 0,WaveField%NStepWave
DO k = 1, NGrid(3)
do j = 1, NGrid(2)
do i = 1, NGrid(1)
@@ -307,19 +300,19 @@ SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, NStepWave, WaveDT, X_
SELECT CASE (iFile)
CASE (1)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveVel (m,i,j,k,1)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveVel (m,i,j,k,1)
CASE (2)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveVel (m,i,j,k,2)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveVel (m,i,j,k,2)
CASE (3)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveVel (m,i,j,k,3)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveVel (m,i,j,k,3)
CASE (4)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveAcc (m,i,j,k,1)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveAcc (m,i,j,k,1)
CASE (5)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveAcc (m,i,j,k,2)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveAcc (m,i,j,k,2)
CASE (6)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveAcc (m,i,j,k,3)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveAcc (m,i,j,k,3)
CASE (7)
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveDynP(m,i,j,k )
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveDynP(m,i,j,k )
END SELECT
!END IF
END DO ! for i
@@ -349,13 +342,13 @@ SUBROUTINE SeaStOut_WriteWvKinFiles( Rootname, SeaSt_Prog, NStepWave, WaveDT, X_
call WriteWvKinHeader( UnWv, 8, Delim, SeaSt_Prog, waveDT, -z_gridPts(1), NGrid, deltaGrid )
- DO m= 0,NStepWave
+ DO m= 0,WaveField%NStepWave
do j = 1, NGrid(2)
do i = 1, NGrid(1)
- if ( associated(WaveElev2) ) then
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveElev1(m,i,j) + WaveElev2(m,i,j)
+ if ( allocated(WaveField%WaveElev2) ) then
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveElev1(m,i,j) + WaveField%WaveElev2(m,i,j)
else
- WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveElev1(m,i,j)
+ WRITE(UnWv,Frmt,ADVANCE='no') Delim, WaveField%WaveElev1(m,i,j)
end if
end do
WRITE (UnWv,'()', IOSTAT=ErrStat) ! write the line return
@@ -988,11 +981,10 @@ SUBROUTINE SeaStOut_CloseOutput ( p, ErrStat, ErrMsg )
END SUBROUTINE SeaStOut_CloseOutput
!====================================================================================================
-SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrStat, ErrMsg )
+SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, ErrStat, ErrMsg )
TYPE(SeaSt_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine.
TYPE(SeaSt_InputFile) , INTENT(IN ) :: InputFileData !< Data from input file
TYPE(SeaSt_ParameterType), INTENT(IN ) :: p !< Parameters
- TYPE(Waves_InitOutputType), INTENT(IN ) :: Waves_InitOut !< Initialization Outputs from the Waves submodule initialization
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
@@ -1033,14 +1025,14 @@ SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrS
WRITE (UnSum,'(/,A/)', IOSTAT=ErrStat2) 'This summary file was generated by '//trim(SeaSt_ProgDesc%Name)//' on '//CurDate()//' at '//CurTime()//'.'
WRITE( UnSum, '(A/)') trim(GetVersion(SeaSt_ProgDesc))
- IF (InputFileData%Waves%WaveMod /= 0 .and. InputFileData%Waves%WaveMod /= 6) THEN
+ IF (InputFileData%WaveMod /= WaveMod_None .and. InputFileData%WaveMod /= WaveMod_ExtFull) THEN
- WRITE( UnSum, '(1X,A61,F8.2,A4/)' ) 'The Mean Sea Level to Still Water Level (MSL2SWL) Offset is :',InputFileData%MSL2SWL,' (m)'
- WRITE( UnSum, '(1X,A15,F8.2,A8)' ) 'Water Density: ', InputFileData%Waves%WtrDens, '(kg/m^3)'
- WRITE( UnSum, '(1X,A15,F8.2,A20,F8.2,A19)' ) 'Water Depth : ', InputFileData%Waves%WtrDpth - InputFileData%MSL2SWL, '(m) relative to MSL; ', &
- InputFileData%Waves%WtrDpth, '(m) relative to SWL'
- WRITE( UnSum, '(1X,A15,F8.2,A20,F8.2,A19/)' ) 'Grid Z_Depth : ', InputFileData%Z_Depth - InputFileData%MSL2SWL, '(m) relative to MSL; ', &
- InputFileData%Z_Depth, '(m) relative to SWL'
+ WRITE( UnSum, '(1X,A61,F8.2,A4/)' ) 'The Mean Sea Level to Still Water Level (MSL2SWL) Offset is :',p%WaveField%MSL2SWL,' (m)'
+ WRITE( UnSum, '(1X,A15,F8.2,A8)' ) 'Water Density: ', p%WaveField%WtrDens, '(kg/m^3)'
+ WRITE( UnSum, '(1X,A15,F8.2,A20,F8.2,A19)' ) 'Water Depth : ', p%WaveField%WtrDpth, '(m) relative to MSL; ', &
+ p%WaveField%EffWtrDpth, '(m) relative to SWL'
+ WRITE( UnSum, '(1X,A15,F8.2,A20,F8.2,A19/)' ) 'Grid Z_Depth : ', InputFileData%Z_Depth - p%WaveField%MSL2SWL, '(m) relative to MSL; ', &
+ InputFileData%Z_Depth, '(m) relative to SWL'
end if
Frmt = '(1X,ES18.4e2,2x,ES18.4e2,2x,ES18.4e2,2x,ES18.4e2)'
@@ -1050,7 +1042,7 @@ SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrS
WRITE( UnSum, '(1X,A78)' ) ' Xi Yi Zi relative to MSL Z relative to SWL'
do i= 1, p%NGridPts
! NOTE: The Waves%WaveKinxi, yi, zi arrays hold all the grid point locations
- WRITE(UnSum,Frmt) InputFileData%Waves%WaveKinGridxi(i), InputFileData%Waves%WaveKinGridyi(i), InputFileData%Waves%WaveKinGridzi(i) + InputFileData%MSL2SWL, InputFileData%Waves%WaveKinGridzi(i)
+ WRITE(UnSum,Frmt) InputFileData%Waves%WaveKinGridxi(i), InputFileData%Waves%WaveKinGridyi(i), InputFileData%Waves%WaveKinGridzi(i) + p%WaveField%MSL2SWL, InputFileData%Waves%WaveKinGridzi(i)
end do
! ! Write User-requested Wave Kinematics locations
@@ -1062,7 +1054,7 @@ SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrS
Frmt = '(1X,I5, 2X,ES18.4e2,2x,ES18.4e2,2x,ES18.4e2,2x,ES18.4e2)'
do i= 1, p%NWaveKin
! NOTE: The InputFileData%WaveKinxi, yi, zi arrays hold the User-request kinematics output locations
- WRITE(UnSum,Frmt) i, p%WaveKinxi(i), p%WaveKinyi(i), p%WaveKinzi(i) + InputFileData%MSL2SWL, p%WaveKinzi(i)
+ WRITE(UnSum,Frmt) i, p%WaveKinxi(i), p%WaveKinyi(i), p%WaveKinzi(i) + p%WaveField%MSL2SWL, p%WaveKinzi(i)
end do
else
@@ -1090,7 +1082,7 @@ SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrS
end do
end if
- IF (InputFileData%Waves%WaveMod /= 6) THEN
+ IF (InputFileData%WaveMod /= WaveMod_ExtFull) THEN
! Write wave kinematics at (0,0)
WRITE( UnSum, '(/)' )
WRITE( UnSum, '(1X,A28/)' ) 'Wave Kinematics DFT at (0,0)'
@@ -1101,9 +1093,9 @@ SUBROUTINE SeaStOut_WrSummaryFile(InitInp, InputFileData, p, Waves_InitOut, ErrS
' (-) ', ' (1/m) ', ' (rad/s) ', ' (deg) ', ' (m) ',' (m) '
! Write the data
- DO I = -1*Waves_InitOut%NStepWave2+1,Waves_InitOut%NStepWave2
- WaveNmbr = WaveNumber ( I*Waves_InitOut%WaveDOmega, InitInp%Gravity, InputFileData%Waves%WtrDpth )
- WRITE( UnSum, '(1X,I10,2X,ES14.5,2X,ES14.5,2X,ES14.5,2X,ES14.5,7X,ES14.5)' ) I, WaveNmbr, I*Waves_InitOut%WaveDOmega, &
+ DO I = -1*p%WaveField%NStepWave2+1, p%WaveField%NStepWave2
+ WaveNmbr = WaveNumber ( I*p%WaveField%WaveDOmega, InitInp%Gravity, p%WaveField%EffWtrDpth )
+ WRITE( UnSum, '(1X,I10,2X,ES14.5,2X,ES14.5,2X,ES14.5,2X,ES14.5,7X,ES14.5)' ) I, WaveNmbr, I*p%WaveField%WaveDOmega, &
p%WaveField%WaveDirArr(ABS(I)), p%WaveField%WaveElevC0( 1,ABS(I ) ) , p%WaveField%WaveElevC0( 2, ABS(I ) )*SIGN(1,I)
END DO
END IF
diff --git a/modules/seastate/src/SeaState_Types.f90 b/modules/seastate/src/SeaState_Types.f90
index e2f7db7d23..f0a1d2bf70 100644
--- a/modules/seastate/src/SeaState_Types.f90
+++ b/modules/seastate/src/SeaState_Types.f90
@@ -66,6 +66,21 @@ MODULE SeaState_Types
LOGICAL :: SeaStSum = .false. !< Generate a SeaState summary file [T/F] [-]
CHARACTER(20) :: OutFmt !< Output format for numerical results [-]
CHARACTER(20) :: OutSFmt !< Output format for header strings [-]
+ INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} [-]
+ REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default) [(m)]
+ REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default) [(kg/m^3)]
+ INTEGER(IntKi) :: WaveDirMod = 0_IntKi !< Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6] [-]
+ REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Incident wave propagation heading direction [(degrees)]
+ LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional [-]
+ REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of members that will use the MacCamy-Fuchs diffraction model [-]
+ REAL(SiKi) :: WvLowCOff = 0.0_R4Ki !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
+ REAL(SiKi) :: WvHiCOff = 0.0_R4Ki !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
+ REAL(SiKi) :: WvLowCOffD = 0.0_R4Ki !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
+ REAL(SiKi) :: WvHiCOffD = 0.0_R4Ki !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
+ REAL(SiKi) :: WvLowCOffS = 0.0_R4Ki !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
+ REAL(SiKi) :: WvHiCOffS = 0.0_R4Ki !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
+ REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
+ INTEGER(IntKi) :: WaveMod = 0_IntKi !< Incident wave kinematics model: See valid values in SeaSt_WaveField module parameters. [-]
END TYPE SeaSt_InputFile
! =======================
! ========= SeaSt_InitInputType =======
@@ -93,45 +108,7 @@ MODULE SeaState_Types
CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputHdr !< The is the list of all HD-related output channel header strings (includes all sub-module channels) [-]
CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputUnt !< The is the list of all HD-related output channel unit strings (includes all sub-module channels) [-]
TYPE(ProgDesc) :: Ver !< Version of SeaState [-]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density, this is necessary to inform glue-code what the module is using for WtrDens (may not be the glue-code's default) [(kg/m^3)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth, this is necessary to inform glue-code what the module is using for WtrDpth (may not be the glue-code's default) [(m)]
- REAL(ReKi) :: EffWtrDpth = 0.0_ReKi !< Effective water depth equal to the sum of input WtrDpth and MSL2SWL [(m)]
- REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Offset between still-water level and mean sea level, this is necessary to inform glue-code what the module is using for MSL2SWL (may not be the glue-code's default) [(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) , DIMENSION(:,:,:), POINTER :: WaveElevC => NULL() !< Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part [(meters)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Wave direction array. Each frequency has a unique direction of WaveNDir > 1 [(degrees)]
- REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction. [(degrees)]
- REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction. [(degrees)]
- REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Incident wave propagation heading direction [(degrees)]
- LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
- REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: WaveDynP => NULL() !< Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAcc => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAccMCF => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveVel => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin (grid) points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: PWaveDynP0 => NULL() !< Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveAcc0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveAccMCF0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveVel0 => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev1 => NULL() !< First order wave elevation [-]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev2 => NULL() !< Second order wave elevation [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveElev0 => NULL() !< Instantaneous elevation time-series of incident waves at the platform reference point [(meters)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Simulation times at which the instantaneous elevation of, velocity of, acceleration of, and loads associated with the incident waves are determined [(sec)]
- REAL(SiKi) :: RhoXg = 0.0_R4Ki !< = WtrDens*Gravity [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Total number of frequency components = total number of time steps in the incident wave [-]
- INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< NStepWave / 2 [-]
- INTEGER(IntKi) :: WaveMod = 0_IntKi !< Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED } [-]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} [-]
- INTEGER(IntKi) :: WaveDirMod = 0_IntKi !< Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6] [-]
- REAL(SiKi) :: WvLowCOff = 0.0_R4Ki !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WvHiCOff = 0.0_R4Ki !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WvLowCOffD = 0.0_R4Ki !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffD = 0.0_R4Ki !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvLowCOffS = 0.0_R4Ki !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffS = 0.0_R4Ki !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
LOGICAL :: InvalidWithSSExctn = .false. !< Whether SeaState configuration is invalid with HydroDyn's state-space excitation (ExctnMod=2) [(-)]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
- REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of MacCamy-Fuchs member [(meters)]
REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: WaveElevSeries !< Wave elevation time-series at each of the points given by WaveElevXY. First dimension is the timestep. Second dimension is XY point number corresponding to second dimension of WaveElevXY. [(m)]
TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Pointer to wave field [-]
END TYPE SeaSt_InitOutputType
@@ -166,39 +143,17 @@ MODULE SeaState_Types
! =======================
! ========= SeaSt_ParameterType =======
TYPE, PUBLIC :: SeaSt_ParameterType
- TYPE(Waves2_ParameterType) :: Waves2 !< Parameter data for the Waves2 module [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Array of time samples, (sec) [-]
REAL(DbKi) :: WaveDT = 0.0_R8Ki !< Wave DT [sec]
INTEGER(IntKi) :: NGridPts = 0_IntKi !< Number of data points in the wave kinematics grid [-]
INTEGER(IntKi) , DIMENSION(1:3) :: NGrid = 0_IntKi !< Number of grid entries in x, y, and z [-]
REAL(ReKi) , DIMENSION(1:3) :: deltaGrid = 0.0_ReKi !< delta between grid points in x, y, and theta (for z) [m,m,rad]
- REAL(ReKi) :: X_HalfWidth = 0.0_ReKi !< Half-width of the domain in the X direction [m]
- REAL(ReKi) :: Y_HalfWidth = 0.0_ReKi !< Half-width of the domain in the Y direction [m]
- REAL(ReKi) :: Z_Depth = 0.0_ReKi !< Depth of the domain the Z direction [m]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Number of user-requested data points in the wave kinematics arrays [-]
INTEGER(IntKi) :: NWaveElev = 0_IntKi !< Number of wave elevation outputs [-]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElevxi !< xi-coordinates for points where the incident wave elevations can be output [(meters)]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElevyi !< yi-coordinates for points where the incident wave elevations can be output [(meters)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev1 => NULL() !< First order wave elevation [-]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev2 => NULL() !< Second order wave elevation [-]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: PWaveDynP0 => NULL() !< Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: WaveDynP => NULL() !< Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAcc => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveAcc0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveVel => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveVel0 => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAccMCF => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKin points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Wave direction array. Each frequency has a unique direction of WaveNDir > 1 [(degrees)]
- 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) , DIMENSION(:,:,:,:), POINTER :: PWaveAccMCF0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKin (grid) points where the incident wave kinematics will be computed [(m/s^2)]
INTEGER(IntKi) :: NWaveKin = 0_IntKi !< Number of points where the incident wave kinematics can be output [-]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinxi !< xi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level [(meters)]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinyi !< yi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level [(meters)]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinzi !< zi-coordinates for points where the incident wave kinematics can be output; these are relative to the mean sea level [(meters)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [(m)]
- REAL(ReKi) :: EffWtrDpth = 0.0_ReKi !< Effective water depth equal to the sum of input WtrDpth and MSL2SWL [(m)]
- REAL(DbKi) :: DT = 0.0_R8Ki !< Time step in seconds for integration of continuous states (if a fixed-step integrator is used) and update of discrete states [-]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Wave stretching model [-]
TYPE(OutParmType) , DIMENSION(:), ALLOCATABLE :: OutParam !< [-]
INTEGER(IntKi) :: NumOuts = 0_IntKi !< Number of SeaState module-level outputs (not the total number including sub-modules [-]
INTEGER(IntKi) :: OutSwtch = 0_IntKi !< Output requested channels to: [1=SeaState.out 2=GlueCode.out 3=both files] [-]
@@ -207,7 +162,6 @@ MODULE SeaState_Types
CHARACTER(1) :: Delim !< Delimiter string for outputs, defaults to space [-]
INTEGER(IntKi) :: UnOutFile = 0_IntKi !< File unit for the SeaState outputs [-]
INTEGER(IntKi) :: OutDec = 0_IntKi !< Write every OutDec time steps [-]
- TYPE(SeaSt_Interp_ParameterType) :: SeaSt_Interp_p !< parameter information from the SeaState Interpolation module [-]
TYPE(SeaSt_WaveFieldType) , POINTER :: WaveField => NULL() !< Wave field [-]
END TYPE SeaSt_ParameterType
! =======================
@@ -333,6 +287,21 @@ subroutine SeaSt_CopyInputFile(SrcInputFileData, DstInputFileData, CtrlCode, Err
DstInputFileData%SeaStSum = SrcInputFileData%SeaStSum
DstInputFileData%OutFmt = SrcInputFileData%OutFmt
DstInputFileData%OutSFmt = SrcInputFileData%OutSFmt
+ DstInputFileData%WaveStMod = SrcInputFileData%WaveStMod
+ DstInputFileData%WtrDpth = SrcInputFileData%WtrDpth
+ DstInputFileData%WtrDens = SrcInputFileData%WtrDens
+ DstInputFileData%WaveDirMod = SrcInputFileData%WaveDirMod
+ DstInputFileData%WaveDir = SrcInputFileData%WaveDir
+ DstInputFileData%WaveMultiDir = SrcInputFileData%WaveMultiDir
+ DstInputFileData%MCFD = SrcInputFileData%MCFD
+ DstInputFileData%WvLowCOff = SrcInputFileData%WvLowCOff
+ DstInputFileData%WvHiCOff = SrcInputFileData%WvHiCOff
+ DstInputFileData%WvLowCOffD = SrcInputFileData%WvLowCOffD
+ DstInputFileData%WvHiCOffD = SrcInputFileData%WvHiCOffD
+ DstInputFileData%WvLowCOffS = SrcInputFileData%WvLowCOffS
+ DstInputFileData%WvHiCOffS = SrcInputFileData%WvHiCOffS
+ DstInputFileData%WaveDOmega = SrcInputFileData%WaveDOmega
+ DstInputFileData%WaveMod = SrcInputFileData%WaveMod
end subroutine
subroutine SeaSt_DestroyInputFile(InputFileData, ErrStat, ErrMsg)
@@ -425,6 +394,21 @@ subroutine SeaSt_PackInputFile(Buf, Indata)
call RegPack(Buf, InData%SeaStSum)
call RegPack(Buf, InData%OutFmt)
call RegPack(Buf, InData%OutSFmt)
+ call RegPack(Buf, InData%WaveStMod)
+ call RegPack(Buf, InData%WtrDpth)
+ call RegPack(Buf, InData%WtrDens)
+ call RegPack(Buf, InData%WaveDirMod)
+ call RegPack(Buf, InData%WaveDir)
+ call RegPack(Buf, InData%WaveMultiDir)
+ call RegPack(Buf, InData%MCFD)
+ call RegPack(Buf, InData%WvLowCOff)
+ call RegPack(Buf, InData%WvHiCOff)
+ call RegPack(Buf, InData%WvLowCOffD)
+ call RegPack(Buf, InData%WvHiCOffD)
+ call RegPack(Buf, InData%WvLowCOffS)
+ call RegPack(Buf, InData%WvHiCOffS)
+ call RegPack(Buf, InData%WaveDOmega)
+ call RegPack(Buf, InData%WaveMod)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -557,6 +541,36 @@ subroutine SeaSt_UnPackInputFile(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%OutSFmt)
if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveStMod)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WtrDpth)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WtrDens)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDirMod)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDir)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveMultiDir)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%MCFD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOff)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOff)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOffD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOffD)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvLowCOffS)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WvHiCOffS)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveDOmega)
+ if (RegCheckErr(Buf, RoutineName)) return
+ call RegUnpack(Buf, OutData%WaveMod)
+ if (RegCheckErr(Buf, RoutineName)) return
end subroutine
subroutine SeaSt_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg)
@@ -705,7 +719,7 @@ subroutine SeaSt_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode,
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: LB(2), UB(2)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SeaSt_CopyInitOutput'
@@ -738,47 +752,7 @@ subroutine SeaSt_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode,
call NWTC_Library_CopyProgDesc(SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
- DstInitOutputData%WtrDens = SrcInitOutputData%WtrDens
- DstInitOutputData%WtrDpth = SrcInitOutputData%WtrDpth
- DstInitOutputData%EffWtrDpth = SrcInitOutputData%EffWtrDpth
- DstInitOutputData%MSL2SWL = SrcInitOutputData%MSL2SWL
- DstInitOutputData%WaveElevC0 => SrcInitOutputData%WaveElevC0
- DstInitOutputData%WaveElevC => SrcInitOutputData%WaveElevC
- DstInitOutputData%WaveDirArr => SrcInitOutputData%WaveDirArr
- DstInitOutputData%WaveDirMin = SrcInitOutputData%WaveDirMin
- DstInitOutputData%WaveDirMax = SrcInitOutputData%WaveDirMax
- DstInitOutputData%WaveDir = SrcInitOutputData%WaveDir
- DstInitOutputData%WaveMultiDir = SrcInitOutputData%WaveMultiDir
- DstInitOutputData%WaveDOmega = SrcInitOutputData%WaveDOmega
- DstInitOutputData%WaveDynP => SrcInitOutputData%WaveDynP
- DstInitOutputData%WaveAcc => SrcInitOutputData%WaveAcc
- DstInitOutputData%WaveAccMCF => SrcInitOutputData%WaveAccMCF
- DstInitOutputData%WaveVel => SrcInitOutputData%WaveVel
- DstInitOutputData%PWaveDynP0 => SrcInitOutputData%PWaveDynP0
- DstInitOutputData%PWaveAcc0 => SrcInitOutputData%PWaveAcc0
- DstInitOutputData%PWaveAccMCF0 => SrcInitOutputData%PWaveAccMCF0
- DstInitOutputData%PWaveVel0 => SrcInitOutputData%PWaveVel0
- DstInitOutputData%WaveElev1 => SrcInitOutputData%WaveElev1
- DstInitOutputData%WaveElev2 => SrcInitOutputData%WaveElev2
- DstInitOutputData%WaveElev0 => SrcInitOutputData%WaveElev0
- DstInitOutputData%WaveTime => SrcInitOutputData%WaveTime
- DstInitOutputData%RhoXg = SrcInitOutputData%RhoXg
- DstInitOutputData%NStepWave = SrcInitOutputData%NStepWave
- DstInitOutputData%NStepWave2 = SrcInitOutputData%NStepWave2
- DstInitOutputData%WaveMod = SrcInitOutputData%WaveMod
- DstInitOutputData%WaveStMod = SrcInitOutputData%WaveStMod
- DstInitOutputData%WaveDirMod = SrcInitOutputData%WaveDirMod
- DstInitOutputData%WvLowCOff = SrcInitOutputData%WvLowCOff
- DstInitOutputData%WvHiCOff = SrcInitOutputData%WvHiCOff
- DstInitOutputData%WvLowCOffD = SrcInitOutputData%WvLowCOffD
- DstInitOutputData%WvHiCOffD = SrcInitOutputData%WvHiCOffD
- DstInitOutputData%WvLowCOffS = SrcInitOutputData%WvLowCOffS
- DstInitOutputData%WvHiCOffS = SrcInitOutputData%WvHiCOffS
DstInitOutputData%InvalidWithSSExctn = SrcInitOutputData%InvalidWithSSExctn
- call SeaSt_Interp_CopyParam(SrcInitOutputData%SeaSt_Interp_p, DstInitOutputData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
- DstInitOutputData%MCFD = SrcInitOutputData%MCFD
if (allocated(SrcInitOutputData%WaveElevSeries)) then
LB(1:2) = lbound(SrcInitOutputData%WaveElevSeries)
UB(1:2) = ubound(SrcInitOutputData%WaveElevSeries)
@@ -811,23 +785,6 @@ subroutine SeaSt_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
end if
call NWTC_Library_DestroyProgDesc(InitOutputData%Ver, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- nullify(InitOutputData%WaveElevC0)
- nullify(InitOutputData%WaveElevC)
- nullify(InitOutputData%WaveDirArr)
- nullify(InitOutputData%WaveDynP)
- nullify(InitOutputData%WaveAcc)
- nullify(InitOutputData%WaveAccMCF)
- nullify(InitOutputData%WaveVel)
- nullify(InitOutputData%PWaveDynP0)
- nullify(InitOutputData%PWaveAcc0)
- nullify(InitOutputData%PWaveAccMCF0)
- nullify(InitOutputData%PWaveVel0)
- nullify(InitOutputData%WaveElev1)
- nullify(InitOutputData%WaveElev2)
- nullify(InitOutputData%WaveElev0)
- nullify(InitOutputData%WaveTime)
- call SeaSt_Interp_DestroyParam(InitOutputData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (allocated(InitOutputData%WaveElevSeries)) then
deallocate(InitOutputData%WaveElevSeries)
end if
@@ -851,150 +808,7 @@ subroutine SeaSt_PackInitOutput(Buf, Indata)
call RegPack(Buf, InData%WriteOutputUnt)
end if
call NWTC_Library_PackProgDesc(Buf, InData%Ver)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%EffWtrDpth)
- call RegPack(Buf, InData%MSL2SWL)
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElevC))
- if (associated(InData%WaveElevC)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElevC), ubound(InData%WaveElevC))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
- end if
- end if
- call RegPack(Buf, InData%WaveDirMin)
- call RegPack(Buf, InData%WaveDirMax)
- call RegPack(Buf, InData%WaveDir)
- call RegPack(Buf, InData%WaveMultiDir)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, associated(InData%WaveDynP))
- if (associated(InData%WaveDynP)) then
- call RegPackBounds(Buf, 4, lbound(InData%WaveDynP), ubound(InData%WaveDynP))
- call RegPackPointer(Buf, c_loc(InData%WaveDynP), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDynP)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAcc))
- if (associated(InData%WaveAcc)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAcc), ubound(InData%WaveAcc))
- call RegPackPointer(Buf, c_loc(InData%WaveAcc), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAcc)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAccMCF))
- if (associated(InData%WaveAccMCF)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAccMCF), ubound(InData%WaveAccMCF))
- call RegPackPointer(Buf, c_loc(InData%WaveAccMCF), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAccMCF)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveVel))
- if (associated(InData%WaveVel)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveVel), ubound(InData%WaveVel))
- call RegPackPointer(Buf, c_loc(InData%WaveVel), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveVel)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveDynP0))
- if (associated(InData%PWaveDynP0)) then
- call RegPackBounds(Buf, 3, lbound(InData%PWaveDynP0), ubound(InData%PWaveDynP0))
- call RegPackPointer(Buf, c_loc(InData%PWaveDynP0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveDynP0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAcc0))
- if (associated(InData%PWaveAcc0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAcc0), ubound(InData%PWaveAcc0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAcc0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAcc0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAccMCF0))
- if (associated(InData%PWaveAccMCF0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAccMCF0), ubound(InData%PWaveAccMCF0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAccMCF0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAccMCF0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveVel0))
- if (associated(InData%PWaveVel0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveVel0), ubound(InData%PWaveVel0))
- call RegPackPointer(Buf, c_loc(InData%PWaveVel0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveVel0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev1))
- if (associated(InData%WaveElev1)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev1), ubound(InData%WaveElev1))
- call RegPackPointer(Buf, c_loc(InData%WaveElev1), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev1)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev2))
- if (associated(InData%WaveElev2)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev2), ubound(InData%WaveElev2))
- call RegPackPointer(Buf, c_loc(InData%WaveElev2), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev2)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev0))
- if (associated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPackPointer(Buf, c_loc(InData%WaveElev0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
- call RegPack(Buf, InData%RhoXg)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
- call RegPack(Buf, InData%WaveMod)
- call RegPack(Buf, InData%WaveStMod)
- call RegPack(Buf, InData%WaveDirMod)
- call RegPack(Buf, InData%WvLowCOff)
- call RegPack(Buf, InData%WvHiCOff)
- call RegPack(Buf, InData%WvLowCOffD)
- call RegPack(Buf, InData%WvHiCOffD)
- call RegPack(Buf, InData%WvLowCOffS)
- call RegPack(Buf, InData%WvHiCOffS)
call RegPack(Buf, InData%InvalidWithSSExctn)
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
- call RegPack(Buf, InData%MCFD)
call RegPack(Buf, allocated(InData%WaveElevSeries))
if (allocated(InData%WaveElevSeries)) then
call RegPackBounds(Buf, 2, lbound(InData%WaveElevSeries), ubound(InData%WaveElevSeries))
@@ -1014,7 +828,7 @@ subroutine SeaSt_UnPackInitOutput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(SeaSt_InitOutputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'SeaSt_UnPackInitOutput'
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: LB(2), UB(2)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
@@ -1049,515 +863,110 @@ subroutine SeaSt_UnPackInitOutput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
end if
call NWTC_Library_UnpackProgDesc(Buf, OutData%Ver) ! Ver
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%EffWtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MSL2SWL)
+ call RegUnpack(Buf, OutData%InvalidWithSSExctn)
if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
+ if (allocated(OutData%WaveElevSeries)) deallocate(OutData%WaveElevSeries)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
call RegUnpackBounds(Buf, 2, LB, UB)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
- else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
+ allocate(OutData%WaveElevSeries(LB(1):UB(1),LB(2):UB(2)),stat=stat)
+ if (stat /= 0) then
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevSeries.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ return
end if
- else
- OutData%WaveElevC0 => null()
- end if
- if (associated(OutData%WaveElevC)) deallocate(OutData%WaveElevC)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
+ call RegUnpack(Buf, OutData%WaveElevSeries)
if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC, UB(1:3)-LB(1:3))
- OutData%WaveElevC(LB(1):,LB(2):,LB(3):) => OutData%WaveElevC
- else
- allocate(OutData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC)
- call RegUnpack(Buf, OutData%WaveElevC)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC => null()
end if
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
+ if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpackPointer(Buf, Ptr, PtrIdx)
if (RegCheckErr(Buf, RoutineName)) return
if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
+ call c_f_pointer(Ptr, OutData%WaveField)
else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
+ allocate(OutData%WaveField,stat=stat)
if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
+ call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
return
end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
+ Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
+ call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
end if
else
- OutData%WaveDirArr => null()
+ OutData%WaveField => null()
end if
- call RegUnpack(Buf, OutData%WaveDirMin)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMax)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMultiDir)
+end subroutine
+
+subroutine SeaSt_CopyContState(SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg)
+ type(SeaSt_ContinuousStateType), intent(in) :: SrcContStateData
+ type(SeaSt_ContinuousStateType), intent(inout) :: DstContStateData
+ integer(IntKi), intent(in ) :: CtrlCode
+ integer(IntKi), intent( out) :: ErrStat
+ character(*), intent( out) :: ErrMsg
+ character(*), parameter :: RoutineName = 'SeaSt_CopyContState'
+ ErrStat = ErrID_None
+ ErrMsg = ''
+ DstContStateData%UnusedStates = SrcContStateData%UnusedStates
+end subroutine
+
+subroutine SeaSt_DestroyContState(ContStateData, ErrStat, ErrMsg)
+ type(SeaSt_ContinuousStateType), intent(inout) :: ContStateData
+ integer(IntKi), intent( out) :: ErrStat
+ character(*), intent( out) :: ErrMsg
+ character(*), parameter :: RoutineName = 'SeaSt_DestroyContState'
+ ErrStat = ErrID_None
+ ErrMsg = ''
+end subroutine
+
+subroutine SeaSt_PackContState(Buf, Indata)
+ type(PackBuffer), intent(inout) :: Buf
+ type(SeaSt_ContinuousStateType), intent(in) :: InData
+ character(*), parameter :: RoutineName = 'SeaSt_PackContState'
+ if (Buf%ErrStat >= AbortErrLev) return
+ call RegPack(Buf, InData%UnusedStates)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
+end subroutine
+
+subroutine SeaSt_UnPackContState(Buf, OutData)
+ type(PackBuffer), intent(inout) :: Buf
+ type(SeaSt_ContinuousStateType), intent(inout) :: OutData
+ character(*), parameter :: RoutineName = 'SeaSt_UnPackContState'
+ if (Buf%ErrStat /= ErrID_None) return
+ call RegUnpack(Buf, OutData%UnusedStates)
if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveDynP)) deallocate(OutData%WaveDynP)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDynP, UB(1:4)-LB(1:4))
- OutData%WaveDynP(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%WaveDynP
- else
- allocate(OutData%WaveDynP(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDynP.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDynP)
- call RegUnpack(Buf, OutData%WaveDynP)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDynP => null()
- end if
- if (associated(OutData%WaveAcc)) deallocate(OutData%WaveAcc)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAcc, UB(1:5)-LB(1:5))
- OutData%WaveAcc(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAcc
- else
- allocate(OutData%WaveAcc(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAcc.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAcc)
- call RegUnpack(Buf, OutData%WaveAcc)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAcc => null()
- end if
- if (associated(OutData%WaveAccMCF)) deallocate(OutData%WaveAccMCF)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAccMCF, UB(1:5)-LB(1:5))
- OutData%WaveAccMCF(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAccMCF
- else
- allocate(OutData%WaveAccMCF(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAccMCF.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAccMCF)
- call RegUnpack(Buf, OutData%WaveAccMCF)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAccMCF => null()
- end if
- if (associated(OutData%WaveVel)) deallocate(OutData%WaveVel)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveVel, UB(1:5)-LB(1:5))
- OutData%WaveVel(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveVel
- else
- allocate(OutData%WaveVel(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveVel.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveVel)
- call RegUnpack(Buf, OutData%WaveVel)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveVel => null()
- end if
- if (associated(OutData%PWaveDynP0)) deallocate(OutData%PWaveDynP0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveDynP0, UB(1:3)-LB(1:3))
- OutData%PWaveDynP0(LB(1):,LB(2):,LB(3):) => OutData%PWaveDynP0
- else
- allocate(OutData%PWaveDynP0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveDynP0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveDynP0)
- call RegUnpack(Buf, OutData%PWaveDynP0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveDynP0 => null()
- end if
- if (associated(OutData%PWaveAcc0)) deallocate(OutData%PWaveAcc0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAcc0, UB(1:4)-LB(1:4))
- OutData%PWaveAcc0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAcc0
- else
- allocate(OutData%PWaveAcc0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAcc0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAcc0)
- call RegUnpack(Buf, OutData%PWaveAcc0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAcc0 => null()
- end if
- if (associated(OutData%PWaveAccMCF0)) deallocate(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAccMCF0, UB(1:4)-LB(1:4))
- OutData%PWaveAccMCF0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAccMCF0
- else
- allocate(OutData%PWaveAccMCF0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAccMCF0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, OutData%PWaveAccMCF0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAccMCF0 => null()
- end if
- if (associated(OutData%PWaveVel0)) deallocate(OutData%PWaveVel0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveVel0, UB(1:4)-LB(1:4))
- OutData%PWaveVel0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveVel0
- else
- allocate(OutData%PWaveVel0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveVel0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveVel0)
- call RegUnpack(Buf, OutData%PWaveVel0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveVel0 => null()
- end if
- if (associated(OutData%WaveElev1)) deallocate(OutData%WaveElev1)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev1, UB(1:3)-LB(1:3))
- OutData%WaveElev1(LB(1):,LB(2):,LB(3):) => OutData%WaveElev1
- else
- allocate(OutData%WaveElev1(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev1.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev1)
- call RegUnpack(Buf, OutData%WaveElev1)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev1 => null()
- end if
- if (associated(OutData%WaveElev2)) deallocate(OutData%WaveElev2)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev2, UB(1:3)-LB(1:3))
- OutData%WaveElev2(LB(1):,LB(2):,LB(3):) => OutData%WaveElev2
- else
- allocate(OutData%WaveElev2(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev2.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev2)
- call RegUnpack(Buf, OutData%WaveElev2)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev2 => null()
- end if
- if (associated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev0, UB(1:1)-LB(1:1))
- OutData%WaveElev0(LB(1):) => OutData%WaveElev0
- else
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev0)
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev0 => null()
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
- call RegUnpack(Buf, OutData%RhoXg)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%InvalidWithSSExctn)
- if (RegCheckErr(Buf, RoutineName)) return
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
- call RegUnpack(Buf, OutData%MCFD)
- if (RegCheckErr(Buf, RoutineName)) return
- if (allocated(OutData%WaveElevSeries)) deallocate(OutData%WaveElevSeries)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- allocate(OutData%WaveElevSeries(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevSeries.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- call RegUnpack(Buf, OutData%WaveElevSeries)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveField)
- else
- allocate(OutData%WaveField,stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveField.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveField)
- call SeaSt_WaveField_UnpackSeaSt_WaveFieldType(Buf, OutData%WaveField) ! WaveField
- end if
- else
- OutData%WaveField => null()
- end if
-end subroutine
-
-subroutine SeaSt_CopyContState(SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg)
- type(SeaSt_ContinuousStateType), intent(in) :: SrcContStateData
- type(SeaSt_ContinuousStateType), intent(inout) :: DstContStateData
- integer(IntKi), intent(in ) :: CtrlCode
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'SeaSt_CopyContState'
- ErrStat = ErrID_None
- ErrMsg = ''
- DstContStateData%UnusedStates = SrcContStateData%UnusedStates
-end subroutine
-
-subroutine SeaSt_DestroyContState(ContStateData, ErrStat, ErrMsg)
- type(SeaSt_ContinuousStateType), intent(inout) :: ContStateData
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'SeaSt_DestroyContState'
- ErrStat = ErrID_None
- ErrMsg = ''
-end subroutine
-
-subroutine SeaSt_PackContState(Buf, Indata)
- type(PackBuffer), intent(inout) :: Buf
- type(SeaSt_ContinuousStateType), intent(in) :: InData
- character(*), parameter :: RoutineName = 'SeaSt_PackContState'
- if (Buf%ErrStat >= AbortErrLev) return
- call RegPack(Buf, InData%UnusedStates)
- if (RegCheckErr(Buf, RoutineName)) return
-end subroutine
-
-subroutine SeaSt_UnPackContState(Buf, OutData)
- type(PackBuffer), intent(inout) :: Buf
- type(SeaSt_ContinuousStateType), intent(inout) :: OutData
- character(*), parameter :: RoutineName = 'SeaSt_UnPackContState'
- if (Buf%ErrStat /= ErrID_None) return
- call RegUnpack(Buf, OutData%UnusedStates)
- if (RegCheckErr(Buf, RoutineName)) return
-end subroutine
-
-subroutine SeaSt_CopyDiscState(SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg)
- type(SeaSt_DiscreteStateType), intent(in) :: SrcDiscStateData
- type(SeaSt_DiscreteStateType), intent(inout) :: DstDiscStateData
- integer(IntKi), intent(in ) :: CtrlCode
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'SeaSt_CopyDiscState'
- ErrStat = ErrID_None
- ErrMsg = ''
- DstDiscStateData%UnusedStates = SrcDiscStateData%UnusedStates
-end subroutine
-
-subroutine SeaSt_DestroyDiscState(DiscStateData, ErrStat, ErrMsg)
- type(SeaSt_DiscreteStateType), intent(inout) :: DiscStateData
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'SeaSt_DestroyDiscState'
- ErrStat = ErrID_None
- ErrMsg = ''
-end subroutine
-
-subroutine SeaSt_PackDiscState(Buf, Indata)
- type(PackBuffer), intent(inout) :: Buf
- type(SeaSt_DiscreteStateType), intent(in) :: InData
- character(*), parameter :: RoutineName = 'SeaSt_PackDiscState'
- if (Buf%ErrStat >= AbortErrLev) return
- call RegPack(Buf, InData%UnusedStates)
+end subroutine
+
+subroutine SeaSt_CopyDiscState(SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg)
+ type(SeaSt_DiscreteStateType), intent(in) :: SrcDiscStateData
+ type(SeaSt_DiscreteStateType), intent(inout) :: DstDiscStateData
+ integer(IntKi), intent(in ) :: CtrlCode
+ integer(IntKi), intent( out) :: ErrStat
+ character(*), intent( out) :: ErrMsg
+ character(*), parameter :: RoutineName = 'SeaSt_CopyDiscState'
+ ErrStat = ErrID_None
+ ErrMsg = ''
+ DstDiscStateData%UnusedStates = SrcDiscStateData%UnusedStates
+end subroutine
+
+subroutine SeaSt_DestroyDiscState(DiscStateData, ErrStat, ErrMsg)
+ type(SeaSt_DiscreteStateType), intent(inout) :: DiscStateData
+ integer(IntKi), intent( out) :: ErrStat
+ character(*), intent( out) :: ErrMsg
+ character(*), parameter :: RoutineName = 'SeaSt_DestroyDiscState'
+ ErrStat = ErrID_None
+ ErrMsg = ''
+end subroutine
+
+subroutine SeaSt_PackDiscState(Buf, Indata)
+ type(PackBuffer), intent(inout) :: Buf
+ type(SeaSt_DiscreteStateType), intent(in) :: InData
+ character(*), parameter :: RoutineName = 'SeaSt_PackDiscState'
+ if (Buf%ErrStat >= AbortErrLev) return
+ call RegPack(Buf, InData%UnusedStates)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -1712,25 +1121,17 @@ subroutine SeaSt_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: i1, i2, i3, i4, i5
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: i1
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SeaSt_CopyParam'
ErrStat = ErrID_None
ErrMsg = ''
- call Waves2_CopyParam(SrcParamData%Waves2, DstParamData%Waves2, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
- DstParamData%WaveTime => SrcParamData%WaveTime
DstParamData%WaveDT = SrcParamData%WaveDT
DstParamData%NGridPts = SrcParamData%NGridPts
DstParamData%NGrid = SrcParamData%NGrid
DstParamData%deltaGrid = SrcParamData%deltaGrid
- DstParamData%X_HalfWidth = SrcParamData%X_HalfWidth
- DstParamData%Y_HalfWidth = SrcParamData%Y_HalfWidth
- DstParamData%Z_Depth = SrcParamData%Z_Depth
- DstParamData%NStepWave = SrcParamData%NStepWave
DstParamData%NWaveElev = SrcParamData%NWaveElev
if (allocated(SrcParamData%WaveElevxi)) then
LB(1:1) = lbound(SrcParamData%WaveElevxi)
@@ -1756,18 +1157,6 @@ subroutine SeaSt_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
end if
DstParamData%WaveElevyi = SrcParamData%WaveElevyi
end if
- DstParamData%WaveElev1 => SrcParamData%WaveElev1
- DstParamData%WaveElev2 => SrcParamData%WaveElev2
- DstParamData%PWaveDynP0 => SrcParamData%PWaveDynP0
- DstParamData%WaveDynP => SrcParamData%WaveDynP
- DstParamData%WaveAcc => SrcParamData%WaveAcc
- DstParamData%PWaveAcc0 => SrcParamData%PWaveAcc0
- DstParamData%WaveVel => SrcParamData%WaveVel
- DstParamData%PWaveVel0 => SrcParamData%PWaveVel0
- DstParamData%WaveAccMCF => SrcParamData%WaveAccMCF
- DstParamData%WaveDirArr => SrcParamData%WaveDirArr
- DstParamData%WaveElevC0 => SrcParamData%WaveElevC0
- DstParamData%PWaveAccMCF0 => SrcParamData%PWaveAccMCF0
DstParamData%NWaveKin = SrcParamData%NWaveKin
if (allocated(SrcParamData%WaveKinxi)) then
LB(1:1) = lbound(SrcParamData%WaveKinxi)
@@ -1805,10 +1194,6 @@ subroutine SeaSt_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
end if
DstParamData%WaveKinzi = SrcParamData%WaveKinzi
end if
- DstParamData%WtrDpth = SrcParamData%WtrDpth
- DstParamData%EffWtrDpth = SrcParamData%EffWtrDpth
- DstParamData%DT = SrcParamData%DT
- DstParamData%WaveStMod = SrcParamData%WaveStMod
if (allocated(SrcParamData%OutParam)) then
LB(1:1) = lbound(SrcParamData%OutParam)
UB(1:1) = ubound(SrcParamData%OutParam)
@@ -1832,9 +1217,6 @@ subroutine SeaSt_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg
DstParamData%Delim = SrcParamData%Delim
DstParamData%UnOutFile = SrcParamData%UnOutFile
DstParamData%OutDec = SrcParamData%OutDec
- call SeaSt_Interp_CopyParam(SrcParamData%SeaSt_Interp_p, DstParamData%SeaSt_Interp_p, CtrlCode, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- if (ErrStat >= AbortErrLev) return
if (associated(SrcParamData%WaveField)) then
if (.not. associated(DstParamData%WaveField)) then
allocate(DstParamData%WaveField, stat=ErrStat2)
@@ -1853,34 +1235,19 @@ subroutine SeaSt_DestroyParam(ParamData, ErrStat, ErrMsg)
type(SeaSt_ParameterType), intent(inout) :: ParamData
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: i1, i2, i3, i4, i5
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: i1
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SeaSt_DestroyParam'
ErrStat = ErrID_None
ErrMsg = ''
- call Waves2_DestroyParam(ParamData%Waves2, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
- nullify(ParamData%WaveTime)
if (allocated(ParamData%WaveElevxi)) then
deallocate(ParamData%WaveElevxi)
end if
if (allocated(ParamData%WaveElevyi)) then
deallocate(ParamData%WaveElevyi)
end if
- nullify(ParamData%WaveElev1)
- nullify(ParamData%WaveElev2)
- nullify(ParamData%PWaveDynP0)
- nullify(ParamData%WaveDynP)
- nullify(ParamData%WaveAcc)
- nullify(ParamData%PWaveAcc0)
- nullify(ParamData%WaveVel)
- nullify(ParamData%PWaveVel0)
- nullify(ParamData%WaveAccMCF)
- nullify(ParamData%WaveDirArr)
- nullify(ParamData%WaveElevC0)
- nullify(ParamData%PWaveAccMCF0)
if (allocated(ParamData%WaveKinxi)) then
deallocate(ParamData%WaveKinxi)
end if
@@ -1899,8 +1266,6 @@ subroutine SeaSt_DestroyParam(ParamData, ErrStat, ErrMsg)
end do
deallocate(ParamData%OutParam)
end if
- call SeaSt_Interp_DestroyParam(ParamData%SeaSt_Interp_p, ErrStat2, ErrMsg2)
- call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (associated(ParamData%WaveField)) then
call SeaSt_WaveField_DestroySeaSt_WaveFieldType(ParamData%WaveField, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
@@ -1913,27 +1278,14 @@ subroutine SeaSt_PackParam(Buf, Indata)
type(PackBuffer), intent(inout) :: Buf
type(SeaSt_ParameterType), intent(in) :: InData
character(*), parameter :: RoutineName = 'SeaSt_PackParam'
- integer(IntKi) :: i1, i2, i3, i4, i5
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: i1
+ integer(IntKi) :: LB(1), UB(1)
logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
- call Waves2_PackParam(Buf, InData%Waves2)
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
call RegPack(Buf, InData%WaveDT)
call RegPack(Buf, InData%NGridPts)
call RegPack(Buf, InData%NGrid)
call RegPack(Buf, InData%deltaGrid)
- call RegPack(Buf, InData%X_HalfWidth)
- call RegPack(Buf, InData%Y_HalfWidth)
- call RegPack(Buf, InData%Z_Depth)
- call RegPack(Buf, InData%NStepWave)
call RegPack(Buf, InData%NWaveElev)
call RegPack(Buf, allocated(InData%WaveElevxi))
if (allocated(InData%WaveElevxi)) then
@@ -1945,102 +1297,6 @@ subroutine SeaSt_PackParam(Buf, Indata)
call RegPackBounds(Buf, 1, lbound(InData%WaveElevyi), ubound(InData%WaveElevyi))
call RegPack(Buf, InData%WaveElevyi)
end if
- call RegPack(Buf, associated(InData%WaveElev1))
- if (associated(InData%WaveElev1)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev1), ubound(InData%WaveElev1))
- call RegPackPointer(Buf, c_loc(InData%WaveElev1), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev1)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev2))
- if (associated(InData%WaveElev2)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev2), ubound(InData%WaveElev2))
- call RegPackPointer(Buf, c_loc(InData%WaveElev2), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev2)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveDynP0))
- if (associated(InData%PWaveDynP0)) then
- call RegPackBounds(Buf, 3, lbound(InData%PWaveDynP0), ubound(InData%PWaveDynP0))
- call RegPackPointer(Buf, c_loc(InData%PWaveDynP0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveDynP0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveDynP))
- if (associated(InData%WaveDynP)) then
- call RegPackBounds(Buf, 4, lbound(InData%WaveDynP), ubound(InData%WaveDynP))
- call RegPackPointer(Buf, c_loc(InData%WaveDynP), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDynP)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAcc))
- if (associated(InData%WaveAcc)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAcc), ubound(InData%WaveAcc))
- call RegPackPointer(Buf, c_loc(InData%WaveAcc), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAcc)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAcc0))
- if (associated(InData%PWaveAcc0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAcc0), ubound(InData%PWaveAcc0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAcc0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAcc0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveVel))
- if (associated(InData%WaveVel)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveVel), ubound(InData%WaveVel))
- call RegPackPointer(Buf, c_loc(InData%WaveVel), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveVel)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveVel0))
- if (associated(InData%PWaveVel0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveVel0), ubound(InData%PWaveVel0))
- call RegPackPointer(Buf, c_loc(InData%PWaveVel0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveVel0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAccMCF))
- if (associated(InData%WaveAccMCF)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAccMCF), ubound(InData%WaveAccMCF))
- call RegPackPointer(Buf, c_loc(InData%WaveAccMCF), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAccMCF)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAccMCF0))
- if (associated(InData%PWaveAccMCF0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAccMCF0), ubound(InData%PWaveAccMCF0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAccMCF0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAccMCF0)
- end if
- end if
call RegPack(Buf, InData%NWaveKin)
call RegPack(Buf, allocated(InData%WaveKinxi))
if (allocated(InData%WaveKinxi)) then
@@ -2057,10 +1313,6 @@ subroutine SeaSt_PackParam(Buf, Indata)
call RegPackBounds(Buf, 1, lbound(InData%WaveKinzi), ubound(InData%WaveKinzi))
call RegPack(Buf, InData%WaveKinzi)
end if
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%EffWtrDpth)
- call RegPack(Buf, InData%DT)
- call RegPack(Buf, InData%WaveStMod)
call RegPack(Buf, allocated(InData%OutParam))
if (allocated(InData%OutParam)) then
call RegPackBounds(Buf, 1, lbound(InData%OutParam), ubound(InData%OutParam))
@@ -2077,7 +1329,6 @@ subroutine SeaSt_PackParam(Buf, Indata)
call RegPack(Buf, InData%Delim)
call RegPack(Buf, InData%UnOutFile)
call RegPack(Buf, InData%OutDec)
- call SeaSt_Interp_PackParam(Buf, InData%SeaSt_Interp_p)
call RegPack(Buf, associated(InData%WaveField))
if (associated(InData%WaveField)) then
call RegPackPointer(Buf, c_loc(InData%WaveField), PtrInIndex)
@@ -2092,38 +1343,13 @@ subroutine SeaSt_UnPackParam(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(SeaSt_ParameterType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'SeaSt_UnPackParam'
- integer(IntKi) :: i1, i2, i3, i4, i5
- integer(IntKi) :: LB(5), UB(5)
+ integer(IntKi) :: i1
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: stat
logical :: IsAllocAssoc
integer(IntKi) :: PtrIdx
type(c_ptr) :: Ptr
if (Buf%ErrStat /= ErrID_None) return
- call Waves2_UnpackParam(Buf, OutData%Waves2) ! Waves2
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
call RegUnpack(Buf, OutData%WaveDT)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NGridPts)
@@ -2132,14 +1358,6 @@ subroutine SeaSt_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%deltaGrid)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%X_HalfWidth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%Y_HalfWidth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%Z_Depth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NWaveElev)
if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%WaveElevxi)) deallocate(OutData%WaveElevxi)
@@ -2170,294 +1388,6 @@ subroutine SeaSt_UnPackParam(Buf, OutData)
call RegUnpack(Buf, OutData%WaveElevyi)
if (RegCheckErr(Buf, RoutineName)) return
end if
- if (associated(OutData%WaveElev1)) deallocate(OutData%WaveElev1)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev1, UB(1:3)-LB(1:3))
- OutData%WaveElev1(LB(1):,LB(2):,LB(3):) => OutData%WaveElev1
- else
- allocate(OutData%WaveElev1(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev1.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev1)
- call RegUnpack(Buf, OutData%WaveElev1)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev1 => null()
- end if
- if (associated(OutData%WaveElev2)) deallocate(OutData%WaveElev2)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev2, UB(1:3)-LB(1:3))
- OutData%WaveElev2(LB(1):,LB(2):,LB(3):) => OutData%WaveElev2
- else
- allocate(OutData%WaveElev2(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev2.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev2)
- call RegUnpack(Buf, OutData%WaveElev2)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev2 => null()
- end if
- if (associated(OutData%PWaveDynP0)) deallocate(OutData%PWaveDynP0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveDynP0, UB(1:3)-LB(1:3))
- OutData%PWaveDynP0(LB(1):,LB(2):,LB(3):) => OutData%PWaveDynP0
- else
- allocate(OutData%PWaveDynP0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveDynP0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveDynP0)
- call RegUnpack(Buf, OutData%PWaveDynP0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveDynP0 => null()
- end if
- if (associated(OutData%WaveDynP)) deallocate(OutData%WaveDynP)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDynP, UB(1:4)-LB(1:4))
- OutData%WaveDynP(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%WaveDynP
- else
- allocate(OutData%WaveDynP(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDynP.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDynP)
- call RegUnpack(Buf, OutData%WaveDynP)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDynP => null()
- end if
- if (associated(OutData%WaveAcc)) deallocate(OutData%WaveAcc)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAcc, UB(1:5)-LB(1:5))
- OutData%WaveAcc(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAcc
- else
- allocate(OutData%WaveAcc(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAcc.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAcc)
- call RegUnpack(Buf, OutData%WaveAcc)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAcc => null()
- end if
- if (associated(OutData%PWaveAcc0)) deallocate(OutData%PWaveAcc0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAcc0, UB(1:4)-LB(1:4))
- OutData%PWaveAcc0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAcc0
- else
- allocate(OutData%PWaveAcc0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAcc0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAcc0)
- call RegUnpack(Buf, OutData%PWaveAcc0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAcc0 => null()
- end if
- if (associated(OutData%WaveVel)) deallocate(OutData%WaveVel)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveVel, UB(1:5)-LB(1:5))
- OutData%WaveVel(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveVel
- else
- allocate(OutData%WaveVel(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveVel.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveVel)
- call RegUnpack(Buf, OutData%WaveVel)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveVel => null()
- end if
- if (associated(OutData%PWaveVel0)) deallocate(OutData%PWaveVel0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveVel0, UB(1:4)-LB(1:4))
- OutData%PWaveVel0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveVel0
- else
- allocate(OutData%PWaveVel0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveVel0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveVel0)
- call RegUnpack(Buf, OutData%PWaveVel0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveVel0 => null()
- end if
- if (associated(OutData%WaveAccMCF)) deallocate(OutData%WaveAccMCF)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAccMCF, UB(1:5)-LB(1:5))
- OutData%WaveAccMCF(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAccMCF
- else
- allocate(OutData%WaveAccMCF(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAccMCF.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAccMCF)
- call RegUnpack(Buf, OutData%WaveAccMCF)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAccMCF => null()
- end if
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
- else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDirArr => null()
- end if
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
- else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC0 => null()
- end if
- if (associated(OutData%PWaveAccMCF0)) deallocate(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAccMCF0, UB(1:4)-LB(1:4))
- OutData%PWaveAccMCF0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAccMCF0
- else
- allocate(OutData%PWaveAccMCF0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAccMCF0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, OutData%PWaveAccMCF0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAccMCF0 => null()
- end if
call RegUnpack(Buf, OutData%NWaveKin)
if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%WaveKinxi)) deallocate(OutData%WaveKinxi)
@@ -2502,14 +1432,6 @@ subroutine SeaSt_UnPackParam(Buf, OutData)
call RegUnpack(Buf, OutData%WaveKinzi)
if (RegCheckErr(Buf, RoutineName)) return
end if
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%EffWtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%DT)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
if (allocated(OutData%OutParam)) deallocate(OutData%OutParam)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
@@ -2539,7 +1461,6 @@ subroutine SeaSt_UnPackParam(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%OutDec)
if (RegCheckErr(Buf, RoutineName)) return
- call SeaSt_Interp_UnpackParam(Buf, OutData%SeaSt_Interp_p) ! SeaSt_Interp_p
if (associated(OutData%WaveField)) deallocate(OutData%WaveField)
call RegUnpack(Buf, IsAllocAssoc)
if (RegCheckErr(Buf, RoutineName)) return
diff --git a/modules/seastate/src/UserWaves.f90 b/modules/seastate/src/UserWaves.f90
index 122dde24af..68dce44c76 100644
--- a/modules/seastate/src/UserWaves.f90
+++ b/modules/seastate/src/UserWaves.f90
@@ -40,7 +40,7 @@ MODULE UserWaves
!----------------------------------------------------------------------------------------------------------------------------------
SUBROUTINE Initial_InitOut_Arrays(InitOut, WaveField, InitInp, WaveDT, ErrStat, ErrMsg)
TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut ! Initialization output data
- TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
+ TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
TYPE(Waves_InitInputType), INTENT(IN ) :: InitInp ! Initialization input data
REAL(DbKi), INTENT(IN ) :: WaveDT ! Value of wave dt, used for filling WaveTime
INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation
@@ -56,18 +56,18 @@ SUBROUTINE Initial_InitOut_Arrays(InitOut, WaveField, InitInp, WaveDT, ErrStat,
ErrMsg = ""
! Allocatable arrays:
- ALLOCATE ( WaveField%WaveElev0 ( 0:InitOut%NStepWave ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElev0.', ErrStat, ErrMsg, RoutineName)
- ALLOCATE ( WaveField%WaveElevC (2, 0:InitOut%NStepWave2, InitInp%NGrid(1)*InitInp%NGrid(2) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElevC.', ErrStat,ErrMsg,RoutineName)
+ ALLOCATE ( WaveField%WaveElev0 ( 0:WaveField%NStepWave ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElev0.', ErrStat, ErrMsg, RoutineName)
+ ALLOCATE ( WaveField%WaveElevC (2, 0:WaveField%NStepWave2, InitInp%NGrid(1)*InitInp%NGrid(2) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElevC.', ErrStat,ErrMsg,RoutineName)
! Allocatable arrays in WaveField:
- ALLOCATE ( WaveField%WaveTime ( 0:InitOut%NStepWave ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveTime.', ErrStat, ErrMsg, RoutineName)
- ALLOCATE ( WaveField%WaveElevC0 (2, 0:InitOut%NStepWave2 ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElevC0.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE ( WaveField%WaveDirArr ( 0:InitOut%NStepWave2 ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveDirArr.',ErrStat, ErrMsg, RoutineName)
+ ALLOCATE ( WaveField%WaveTime ( 0:WaveField%NStepWave ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveTime.', ErrStat, ErrMsg, RoutineName)
+ ALLOCATE ( WaveField%WaveElevC0 (2, 0:WaveField%NStepWave2 ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElevC0.',ErrStat, ErrMsg, RoutineName)
+ ALLOCATE ( WaveField%WaveDirArr ( 0:WaveField%NStepWave2 ) , STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveDirArr.',ErrStat, ErrMsg, RoutineName)
- ALLOCATE ( WaveField%WaveElev1(0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElev1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%WaveDynP (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveDynP.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%WaveVel (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveVel.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%WaveAcc (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveAcc.', ErrStat,ErrMsg,RoutineName)
+ ALLOCATE ( WaveField%WaveElev1(0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElev1.', ErrStat,ErrMsg,RoutineName)
+ ALLOCATE ( WaveField%WaveDynP (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveDynP.', ErrStat,ErrMsg,RoutineName)
+ ALLOCATE ( WaveField%WaveVel (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveVel.', ErrStat,ErrMsg,RoutineName)
+ ALLOCATE ( WaveField%WaveAcc (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStat2 ); IF (ErrStat2 /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveAcc.', ErrStat,ErrMsg,RoutineName)
if (ErrStat >= AbortErrLev) return
@@ -79,7 +79,7 @@ SUBROUTINE Initial_InitOut_Arrays(InitOut, WaveField, InitInp, WaveDT, ErrStat,
! Calculate the array of simulation times at which the instantaneous
! elevation of, velocity of, acceleration of, and loads associated with
! the incident waves are to be determined:
- DO I = 0,InitOut%NStepWave ! Loop through all time steps
+ DO I = 0,WaveField%NStepWave ! Loop through all time steps
WaveField%WaveTime(I) = I * WaveDT
END DO ! I - All time steps
@@ -93,15 +93,15 @@ SUBROUTINE Initial_InitOut_Arrays(InitOut, WaveField, InitInp, WaveDT, ErrStat,
WaveField%WaveDirArr = 0.0
! scalars (adjusted later, if necessary)
- InitOut%WaveDirMin = 0.0
- InitOut%WaveDirMax = 0.0
+ WaveField%WaveDirMin = 0.0
+ WaveField%WaveDirMax = 0.0
InitOut%WaveNDir = 1
END SUBROUTINE Initial_InitOut_Arrays
!----------------------------------------------------------------------------------------------------------------------!
! !
-! WaveMod = 5 !
+! WaveMod = 5 (WaveMod_ExtElev) !
! !
!----------------------------------------------------------------------------------------------------------------------!
@@ -324,16 +324,16 @@ SUBROUTINE UserWaveElevations_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
RETURN
END IF
- !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, InitOut%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 5
+ !>>>>>> COMPUTE INITOUT SCALARS WaveField%NStepWave, WaveField%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 5
! Set new value for NStepWave so that the FFT algorithms are efficient. We will use the values passed in rather than what is read from the file
! NOTE: This method is what is used in the VariousWaves_Init routine in Waves.f90
- InitOut%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer
- IF ( MOD(InitOut%NStepWave,2) == 1 ) InitOut%NStepWave = InitOut%NStepWave + 1 ! larger or equal to WaveTMax/WaveDT.
- InitOut%NStepWave2 = MAX( InitOut%NStepWave/2, 1 ) ! Make sure that NStepWave is an even product of small factors (PSF) that is
- InitOut%NStepWave = 2*PSF ( InitOut%NStepWave2, 9 ) ! greater or equal to WaveTMax/WaveDT to ensure that the FFT is efficient.
- InitOut%NStepWave2 = InitOut%NStepWave/2 ! Update the value of NStepWave2 based on the value needed for NStepWave.
- InitOut%WaveTMax = InitOut%NStepWave*InitInp%WaveDT ! Update the value of WaveTMax based on the value needed for NStepWave.
- InitOut%WaveDOmega = TwoPi/InitInp%WaveTMax ! Compute the frequency step for incident wave calculations.
+ WaveField%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer
+ IF ( MOD(WaveField%NStepWave,2) == 1 ) WaveField%NStepWave = WaveField%NStepWave + 1 ! larger or equal to WaveTMax/WaveDT.
+ WaveField%NStepWave2 = MAX( WaveField%NStepWave/2, 1 ) ! Make sure that NStepWave is an even product of small factors (PSF) that is
+ WaveField%NStepWave = 2*PSF ( WaveField%NStepWave2, 9 ) ! greater or equal to WaveTMax/WaveDT to ensure that the FFT is efficient.
+ WaveField%NStepWave2 = WaveField%NStepWave/2 ! Update the value of NStepWave2 based on the value needed for NStepWave.
+ InitOut%WaveTMax = WaveField%NStepWave*InitInp%WaveDT ! Update the value of WaveTMax based on the value needed for NStepWave.
+ WaveField%WaveDOmega = TwoPi/InitInp%WaveTMax ! Compute the frequency step for incident wave calculations.
! >>> Allocate and initialize (set to 0) InitOut arrays
call Initial_InitOut_Arrays(InitOut, WaveField, InitInp, InitInp%WaveDT, ErrStatTmp, ErrMsgTmp); CALL SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
@@ -341,14 +341,14 @@ SUBROUTINE UserWaveElevations_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
! Give warning if the number of timesteps changed
- IF ( WaveElevData%NStepWave /= InitOut%NStepWave ) THEN
+ IF ( WaveElevData%NStepWave /= WaveField%NStepWave ) THEN
CALL SetErrStat(ErrID_Warn, ' Changed number of timesteps from '//TRIM(Num2LStr(WaveElevData%NStepWave))//' to '// &
- TRIM(Num2LStr(InitOut%NStepWave))//' in order to calculate the frequency information from the wave elevations. '// &
+ TRIM(Num2LStr(WaveField%NStepWave))//' in order to calculate the frequency information from the wave elevations. '// &
'Wave elevations during additional time are padded with zero wave elevation.',ErrStat,ErrMsg,RoutineName)
ENDIF
! Allocate array to hold the wave elevations for calculation of FFT.
- ALLOCATE ( TmpFFTWaveElev( 0:InitOut%NStepWave-1 ), STAT=ErrStatTmp )
+ ALLOCATE ( TmpFFTWaveElev( 0:WaveField%NStepWave-1 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array TmpFFTWaveElev.',ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -361,12 +361,12 @@ SUBROUTINE UserWaveElevations_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
TmpFFTWaveElev = 0.0_SiKi
! Copy values over
- DO I=0,MIN(WaveElevData%NStepWave,InitOut%NStepWave-1)
+ DO I=0,MIN(WaveElevData%NStepWave,WaveField%NStepWave-1)
TmpFFTWaveElev(I) = WaveElevData%WaveElev(I)
ENDDO
! Initialize the FFT
- CALL InitFFT ( InitOut%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
+ CALL InitFFT ( WaveField%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -382,11 +382,11 @@ SUBROUTINE UserWaveElevations_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
END IF
! Copy the resulting TmpFFTWaveElev(:) data over to the InitOut%WaveElevC0 array
- DO I=1,InitOut%NStepWave2-1
+ DO I=1,WaveField%NStepWave2-1
WaveField%WaveElevC0 (1,I) = TmpFFTWaveElev(2*I-1)
WaveField%WaveElevC0 (2,I) = TmpFFTWaveElev(2*I)
ENDDO
- WaveField%WaveElevC0(:,InitOut%NStepWave2) = 0.0_SiKi
+ WaveField%WaveElevC0(:,WaveField%NStepWave2) = 0.0_SiKi
CALL ExitFFT(FFT_Data, ErrStatTmp)
CALL SetErrStat(ErrStatTmp,'Error occured while cleaning up after the FFTs.', ErrStat,ErrMsg,RoutineName)
@@ -411,7 +411,7 @@ END SUBROUTINE UserWaveElevations_Init
!----------------------------------------------------------------------------------------------------------------------!
! !
-! WaveMod = 6 !
+! WaveMod = 6 (WaveMod_ExtFull) !
! !
!----------------------------------------------------------------------------------------------------------------------!
@@ -454,20 +454,20 @@ SUBROUTINE UserWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
- !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, InitOut%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 6
+ !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, WaveField%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 6
! Perform some initialization computations including calculating the
! total number of time steps in the incident wave and ALLOCATing the
! arrays; initialize the unneeded values to zero:
- InitOut%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer
- IF (.NOT. (EqualRealNos( REAL(InitInp%WaveTMax, SiKi) - REAL(InitOut%NStepWave*InitInp%WaveDT, SiKi), 0.0_SiKi ) ) ) THEN
+ WaveField%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer
+ IF (.NOT. (EqualRealNos( REAL(InitInp%WaveTMax, SiKi) - REAL(WaveField%NStepWave*InitInp%WaveDT, SiKi), 0.0_SiKi ) ) ) THEN
ErrMsg = 'For WaveMod = 5 or 6, WaveTMax must be a multiple of WaveDT'
ErrStat = ErrID_Fatal
RETURN
END IF
- InitOut%NStepWave2 = InitOut%NStepWave/2
- InitOut%WaveTMax = InitInp%WaveTMax ! bjj added this
- InitOut%WaveDOmega = TwoPi/InitInp%WaveTMax ! bjj added this
+ WaveField%NStepWave2 = WaveField%NStepWave/2
+ InitOut%WaveTMax = InitInp%WaveTMax
+ WaveField%WaveDOmega = TwoPi/InitInp%WaveTMax
! >>> Allocate and initialize (set to 0) InitOut arrays
call Initial_InitOut_Arrays(InitOut, WaveField, InitInp, InitInp%WaveDT, ErrStatTmp, ErrMsgTmp); CALL SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
@@ -512,7 +512,7 @@ SUBROUTINE UserWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END IF
end do
- DO m = 0,InitOut%NStepWave
+ DO m = 0,WaveField%NStepWave
icount = 1
do k = 1, InitInp%NGrid(3)
do j = 1, InitInp%NGrid(2)
@@ -572,7 +572,7 @@ SUBROUTINE UserWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END IF
end do
- DO m = 0,InitOut%NStepWave
+ DO m = 0,WaveField%NStepWave
do j = 1, InitInp%NGrid(2)
! Extract fields from current line
IF (.not. ExtractFields(UnWv, WaveDataStr(:), InitInp%NGrid(1))) THEN
@@ -614,7 +614,7 @@ FUNCTION ExtractFields(FU, s, n) result(OK)
READ(FU, FMT='(A)', IOSTAT=ErrStat) TextLine
IF (ErrStat/=0) THEN
ErrStat = ErrID_Fatal
- WRITE(ErrMsg,'(A,I0,A,I0,A)') 'Failed to read line ',I+2,' (out of ',InitOut%NStepWave+1,' expected lines) in file '//TRIM(FileName)//&
+ WRITE(ErrMsg,'(A,I0,A,I0,A)') 'Failed to read line ',I+2,' (out of ',WaveField%NStepWave+1,' expected lines) in file '//TRIM(FileName)//&
& '. Check that the number of lines (without header) is equal to WaveTMax/WaveDT. '
OK=.FALSE.
RETURN
@@ -644,17 +644,17 @@ END SUBROUTINE UserWaves_Init
!----------------------------------------------------------------------------------------------------------------------!
! !
-! WaveMod = 7 !
+! WaveMod = 7 (WaveMod_UserFreq) !
! !
!----------------------------------------------------------------------------------------------------------------------!
!-----------------------------------------------------------------------------------------------------------------------
!> This subroutine reads in the wave components from a file and reconstructs the frequency information.
-SUBROUTINE WaveComp_ReadFile ( InitInp, InitOut, WaveCompData, ErrStat, ErrMsg )
+SUBROUTINE WaveComp_ReadFile ( InitInp, WaveDOmega, WaveCompData, ErrStat, ErrMsg )
IMPLICIT NONE
TYPE(Waves_InitInputType), INTENT(INOUT) :: InitInp !< Input data for initialization routine
- TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut !< Output data for initialization routine
+ REAL(SiKi), INTENT(INOUT) :: WaveDOmega !< wave field data
TYPE(WaveCompInputDataFile), INTENT( OUT) :: WaveCompData !< Wave component file data
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error Status at return
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
@@ -762,7 +762,7 @@ SUBROUTINE WaveComp_ReadFile ( InitInp, InitOut, WaveCompData, ErrStat, ErrMsg )
END IF
! Compute the frequency step for incident wave calculations.
- InitOut%WaveDOmega = TwoPi/InitInp%WaveTMax
+ WaveDOmega = TwoPi/InitInp%WaveTMax
!--------------------------------------------------
! Read in the data
@@ -820,7 +820,7 @@ SUBROUTINE WaveComp_ReadFile ( InitInp, InitOut, WaveCompData, ErrStat, ErrMsg )
END IF
! Check if the frequency is valid
- OmegaRatio = WaveAngFreq/InitOut%WaveDOmega
+ OmegaRatio = WaveAngFreq/WaveDOmega
IF (ABS(OmegaRatio - REAL(NINT(OmegaRatio),SiKi))>WaveDOmega_RelTol) THEN
CALL SetErrStat( ErrID_Fatal, 'The wave frequency on line number '//TRIM(Num2LStr(I))//' is not an integer multiple of the frequency resolution given by 1/WaveTMax.', ErrStat, ErrMsg, RoutineName )
CALL CleanUpError()
@@ -899,22 +899,22 @@ SUBROUTINE UserWaveComponents_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
! Statement to user
CALL WrScr1 ( ' Reading in wave component data from wave kinematics files with root name "'//TRIM(InitInp%WvKinFile)//'".' )
- ! Read in the wave component data
- CALL WaveComp_ReadFile (InitInp, InitOut, WaveCompData, ErrStatTmp, ErrMsgTmp )
+ ! Read in the wave component data ! NOTE THAT THIS OVERWRITES InitInp%WaveTMax
+ CALL WaveComp_ReadFile (InitInp, WaveField%WaveDOmega, WaveCompData, ErrStatTmp, ErrMsgTmp )
CALL SetErrStat(ErrStatTmp,ErrMsgTmp,ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
RETURN
END IF
- !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, InitOut%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 7
+ !>>>>>> COMPUTE INITOUT SCALARS WaveField%NStepWave, WaveField%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 7
MaxWaveAngFreq = MAXVAL(WaveCompData%WaveAngFreq)
! NStepWave2 should be large enough to accommodate the highest user frequency component and
! produce a time step no larger than the user WaveDT.
- InitOut%NStepWave2 = MAX( NINT(MaxWaveAngFreq / InitOut%WaveDOmega) + 1_IntKi, &
- CEILING(TwoPi/(InitInp%WaveDt*InitOut%WaveDOmega)) )
- InitOut%NStepWave2 = PSF ( InitOut%NStepWave2, 9 ) ! Make sure NStepWave2 is a product of small factors (PSF) greater or equal to what's required by the user input
- InitOut%NStepWave = InitOut%NStepWave2 * 2_IntKi ! NStepWave is guaranteed to be even
+ WaveField%NStepWave2 = MAX( NINT(MaxWaveAngFreq / WaveField%WaveDOmega) + 1_IntKi, &
+ CEILING(TwoPi/(InitInp%WaveDt*WaveField%WaveDOmega)) )
+ WaveField%NStepWave2 = PSF ( WaveField%NStepWave2, 9 ) ! Make sure NStepWave2 is a product of small factors (PSF) greater or equal to what's required by the user input
+ WaveField%NStepWave = WaveField%NStepWave2 * 2_IntKi ! NStepWave is guaranteed to be even
InitOut%WaveTMax = InitInp%WaveTMax ! Copy over WaveTMax.
! Note that InitOut%WaveDOmega is computed in WaveComp_ReadFile:
@@ -922,7 +922,7 @@ SUBROUTINE UserWaveComponents_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
!BJJ: Note that this is changing an InitInp value. This seems dangerous... check that this isn't an issue elsewhere
- InitInp%WaveDT = InitOut%WaveTMax / InitOut%NStepWave ! Update the value of WaveDT based on the value needed for NStepWave.
+ InitInp%WaveDT = InitOut%WaveTMax / WaveField%NStepWave ! Update the value of WaveDT based on the value needed for NStepWave.
CALL WrScr1 (' Setting WaveDT to ' // TRIM(Num2Lstr(InitInp%WaveDt)) // ' sec.')
@@ -930,7 +930,7 @@ SUBROUTINE UserWaveComponents_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
call Initial_InitOut_Arrays(InitOut, WaveField, InitInp, InitInp%WaveDT, ErrStatTmp, ErrMsgTmp); CALL SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- ALLOCATE ( IsSpecified( 0:InitOut%NStepWave2 ), STAT = ErrStatTmp)
+ ALLOCATE ( IsSpecified( 0:WaveField%NStepWave2 ), STAT = ErrStatTmp)
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array IsSpecified.',ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -944,11 +944,11 @@ SUBROUTINE UserWaveComponents_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
! Copy the wave frequency component information to the InitOut%WaveElevC0 array
DO I=1,WaveCompData%NCompWave
- J = NINT(WaveCompData%WaveAngFreq(I)/InitOut%WaveDOmega)
+ J = NINT(WaveCompData%WaveAngFreq(I)/WaveField%WaveDOmega)
IF ( .NOT. IsSpecified(J) ) THEN
IsSpecified(J) = .TRUE.
- WaveField%WaveElevC0(1,J) = WaveCompData%WaveAmp(I) * COS(WaveCompData%WavePhase(I)) * InitOut%NStepWave2
- WaveField%WaveElevC0(2,J) = WaveCompData%WaveAmp(I) * SIN(WaveCompData%WavePhase(I)) * InitOut%NStepWave2
+ WaveField%WaveElevC0(1,J) = WaveCompData%WaveAmp(I) * COS(WaveCompData%WavePhase(I)) * WaveField%NStepWave2
+ WaveField%WaveElevC0(2,J) = WaveCompData%WaveAmp(I) * SIN(WaveCompData%WavePhase(I)) * WaveField%NStepWave2
WaveField%WaveDirArr(J) = WaveCompData%WaveDir(I)
ELSE
CALL SetErrStat(ErrID_Fatal,'Wave component with angular frequency ' //TRIM( Num2Lstr( WaveCompData%WaveAngFreq(I) ) )// &
@@ -959,7 +959,7 @@ SUBROUTINE UserWaveComponents_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMs
END DO
! Make sure the DC and Nyquist components are zero - should be redundant
WaveField%WaveElevC0(:,0 ) = 0.0_SiKi
- WaveField%WaveElevC0(:,InitOut%NStepWave2) = 0.0_SiKi
+ WaveField%WaveElevC0(:,WaveField%NStepWave2) = 0.0_SiKi
CALL CleanUp()
diff --git a/modules/seastate/src/Waves.f90 b/modules/seastate/src/Waves.f90
index 4bc80285c3..fd1efff906 100644
--- a/modules/seastate/src/Waves.f90
+++ b/modules/seastate/src/Waves.f90
@@ -56,7 +56,7 @@ MODULE Waves
!=======================================================================
- FUNCTION WavePkShpDefault ( Hs, Tp )
+ FUNCTION WavePkShpDefault ( WaveMod, Hs, Tp )
! This FUNCTION is used to return the default value of the peak shape
@@ -73,10 +73,10 @@ FUNCTION WavePkShpDefault ( Hs, Tp )
! Passed Variables:
-
- REAL(SiKi), INTENT(IN ) :: Hs ! Significant wave height (meters)
- REAL(SiKi), INTENT(IN ) :: Tp ! Peak spectral period (sec)
- REAL(SiKi) :: WavePkShpDefault ! This function = default value of the peak shape parameter of the incident wave spectrum conditioned on significant wave height and peak spectral period (-)
+ INTEGER(IntKi), INTENT(IN ) :: WaveMod
+ REAL(SiKi), INTENT(IN ) :: Hs ! Significant wave height (meters)
+ REAL(SiKi), INTENT(IN ) :: Tp ! Peak spectral period (sec)
+ REAL(SiKi) :: WavePkShpDefault ! This function = default value of the peak shape parameter of the incident wave spectrum conditioned on significant wave height and peak spectral period (-)
! Local Variables:
@@ -87,17 +87,32 @@ FUNCTION WavePkShpDefault ( Hs, Tp )
! Compute the default peak shape parameter of the incident wave spectrum,
! conditioned on significant wave height and peak spectral period:
+
+ if ( WaveMod == WaveMod_JONSWAP ) then
+
+ if ( Hs <= 0.0_SiKi ) then
+
+ WavePkShpDefault = 1.0
+
+ else
- TpOvrSqrtHs = Tp/SQRT(Hs)
+ TpOvrSqrtHs = Tp/SQRT(Hs)
- IF ( TpOvrSqrtHs <= 3.6 ) THEN
- WavePkShpDefault = 5.0
- ELSEIF ( TpOvrSqrtHs >= 5.0 ) THEN
- WavePkShpDefault = 1.0
- ELSE
- WavePkShpDefault = EXP( 5.75 - 1.15*TpOvrSqrtHs )
- END IF
+ IF ( TpOvrSqrtHs <= 3.6 ) THEN
+ WavePkShpDefault = 5.0
+ ELSEIF ( TpOvrSqrtHs >= 5.0 ) THEN
+ WavePkShpDefault = 1.0
+ ELSE
+ WavePkShpDefault = EXP( 5.75 - 1.15*TpOvrSqrtHs )
+ END IF
+ end if
+ else
+
+ WavePkShpDefault = 1.0
+
+ end if
+
RETURN
@@ -570,11 +585,11 @@ SUBROUTINE StillWaterWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Initialize everything to zero:
- !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, InitOut%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 0
- InitOut%NStepWave = 2 ! We must have at least two elements in order to interpolate later on
- InitOut%NStepWave2 = 1
- InitOut%WaveTMax = InitInp%WaveTMax ! bjj added this... I don't think it was set anywhere for this wavemod.
- InitOut%WaveDOmega = 0.0
+ !>>>>>> COMPUTE INITOUT SCALARS WaveField%NStepWave, WaveField%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 0 (WaveMod_None)
+ WaveField%NStepWave = 2 ! We must have at least two elements in order to interpolate later on
+ WaveField%NStepWave2 = 1
+ InitOut%WaveTMax = InitInp%WaveTMax
+ WaveField%WaveDOmega = 0.0
! >>> Allocate and initialize (set to 0) InitOut arrays
call Initial_InitOut_Arrays(InitOut, WaveField, InitInp, 1.0_DbKi, ErrStatTmp, ErrMsgTmp); CALL SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
@@ -711,8 +726,8 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
NWaveKin0Prime = 0
DO J = 1,InitInp%NWaveKinGrid ! Loop through all mesh points where the incident wave kinematics will be computed
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
- IF ( InitInp%WaveKinGridzi(J) >= -InitInp%WtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
+ IF ( InitInp%WaveKinGridzi(J) >= -WaveField%EffWtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
NWaveKin0Prime = NWaveKin0Prime + 1
END IF
END DO ! J - All Morison nodes where the incident wave kinematics will be computed
@@ -736,8 +751,8 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
I = 1
DO J = 1,InitInp%NWaveKinGrid ! Loop through all points where the incident wave kinematics will be computed without stretching
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
- IF ( InitInp%WaveKinGridzi(J) >= -InitInp%WtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
+ IF ( InitInp%WaveKinGridzi(J) >= -WaveField%EffWtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
WaveKinzi0Prime(I) = InitInp%WaveKinGridzi(J)
WaveKinPrimeMap(I) = J
@@ -770,21 +785,21 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! used to calculate the number of multidirectional wave directions (WaveNDir) and the UserWaveElevations_Init subroutine
! will need to be updated.
- !>>>>>> COMPUTE INITOUT SCALARS InitOut%NStepWave, InitOut%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 1,2,3,4,10 (5 and 7 also call this routine, but have been set already)
+ !>>>>>> COMPUTE INITOUT SCALARS WaveField%NStepWave, WaveField%NStepWave2, InitOut%WaveTMax, and InitOut%WaveDOmega for WAVEMOD = 1,2,3,4,10 (5 and 7 also call this routine, but have been set already)
! NOTE: For WaveMod = 5, NStepWave and several other things were already set in the UserWaveElevations_Init routine
! using file information (an FFT was performed there, so the information was needed before now).
- ! Same with WaveMod = 7. With WaveMod = 7, WaveDirArr is also populated in UserWaveComponents_Init routine.
+ ! Same with WaveMod = 7 (WaveMod_UserFreq). With WaveMod = 7, WaveDirArr is also populated in UserWaveComponents_Init routine.
! Need to make sure the wave-direction in formation is not overwritten later.
- IF (InitInp%WaveMod /= 5 .AND. InitInp%WaveMod /= 7) THEN
- InitOut%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer ...
- IF ( MOD(InitOut%NStepWave,2) == 1 ) InitOut%NStepWave = InitOut%NStepWave + 1 ! ... larger or equal to WaveTMax/WaveDT.
+ IF (WaveField%WaveMod /= WaveMod_ExtElev .AND. WaveField%WaveMod /= WaveMod_UserFreq) THEN
+ WaveField%NStepWave = CEILING ( InitInp%WaveTMax/InitInp%WaveDT ) ! Set NStepWave to an even integer ...
+ IF ( MOD(WaveField%NStepWave,2) == 1 ) WaveField%NStepWave = WaveField%NStepWave + 1 ! ... larger or equal to WaveTMax/WaveDT.
- InitOut%NStepWave2 = MAX( InitOut%NStepWave/2, 1 ) ! Make sure that NStepWave is an even product of small factors (PSF) that is
- InitOut%NStepWave = 2 * PSF( InitOut%NStepWave2, 9 ) ! greater or equal to WaveTMax/WaveDT to ensure that the FFT is efficient.
+ WaveField%NStepWave2 = MAX( WaveField%NStepWave/2, 1 ) ! Make sure that NStepWave is an even product of small factors (PSF) that is
+ WaveField%NStepWave = 2 * PSF( WaveField%NStepWave2, 9 ) ! greater or equal to WaveTMax/WaveDT to ensure that the FFT is efficient.
- InitOut%NStepWave2 = InitOut%NStepWave/2 ! Update the value of NStepWave2 based on the value needed for NStepWave.
- InitOut%WaveTMax = InitOut%NStepWave*InitInp%WaveDT ! Update the value of WaveTMax based on the value needed for NStepWave.
- InitOut%WaveDOmega = TwoPi/InitOut%WaveTMax ! Compute the frequency step for incident wave calculations.
+ WaveField%NStepWave2 = WaveField%NStepWave/2 ! Update the value of NStepWave2 based on the value needed for NStepWave.
+ InitOut%WaveTMax = WaveField%NStepWave*InitInp%WaveDT ! Update the value of WaveTMax based on the value needed for NStepWave.
+ WaveField%WaveDOmega = TwoPi/InitOut%WaveTMax ! Compute the frequency step for incident wave calculations.
! >>> Allocate and initialize (set to 0) InitOut arrays
call Initial_InitOut_Arrays(InitOut, WaveField, InitInp, InitInp%WaveDT, ErrStatTmp, ErrMsgTmp); CALL SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
@@ -793,152 +808,152 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Allocate all the arrays we need.
- ALLOCATE ( tmpComplexArr(0:InitOut%NStepWave2 ), STAT=ErrStatTmp )
+ ALLOCATE ( tmpComplexArr(0:WaveField%NStepWave2 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array tmpComplexArr.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynPC0 (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynPC0 (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynPC0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVelC0Hxi (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVelC0Hxi (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVelC0Hxi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVelC0Hyi (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVelC0Hyi (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVelC0Hyi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVelC0V (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVelC0V (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVelC0V.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAccC0Hxi (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0Hxi (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0Hxi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAccC0Hyi (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0Hyi (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0Hyi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAccC0V (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0V (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0V.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP0B (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP0B (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP0B.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel0Hxi (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel0Hxi (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel0Hxi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel0Hyi (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel0Hyi (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel0Hyi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel0V (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel0V (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel0V.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0Hxi (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0Hxi (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0Hxi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0Hyi (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0Hyi (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0Hyi.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0V (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0V (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0V.', ErrStat,ErrMsg,RoutineName)
- IF (InitInp%MCFD > 0.0_SiKi) THEN ! MacCamy-Fuchs model
+ IF (WaveField%MCFD > 0.0_SiKi) THEN ! MacCamy-Fuchs model
- ALLOCATE ( WaveAccC0HxiMCF(0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0HxiMCF(0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0HxiMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAccC0HyiMCF(0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0HyiMCF(0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0HyiMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAccC0VMCF (0:InitOut%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAccC0VMCF (0:WaveField%NStepWave2 ,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAccC0VMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0HxiMCF (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0HxiMCF (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0HxiMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0HyiMCF (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0HyiMCF (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0HyiMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc0VMCF (0:InitOut%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc0VMCF (0:WaveField%NStepWave-1,NWaveKin0Prime ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc0VMCF.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%WaveAccMCF (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%WaveAccMCF (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveAccMCF.', ErrStat,ErrMsg,RoutineName)
END IF
- IF (InitInp%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
+ IF (WaveField%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
- ALLOCATE ( PWaveDynPC0BPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveDynPC0BPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveDynPC0BPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVelC0HxiPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVelC0HxiPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVelC0HxiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVelC0HyiPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVelC0HyiPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVelC0HyiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVelC0VPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVelC0VPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVelC0VPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAccC0HxiPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0HxiPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0HxiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAccC0HyiPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0HyiPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0HyiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAccC0VPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0VPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0VPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveDynP0BPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveDynP0BPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveDynP0BPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVel0HxiPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVel0HxiPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVel0HxiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVel0HyiPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVel0HyiPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVel0HyiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveVel0VPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveVel0VPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveVel0Pz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0HxiPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0HxiPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0HxiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0HyiPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0HyiPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0HyiPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0VPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0VPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0VPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%PWaveDynP0 (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%PWaveDynP0 (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%PWaveDynP0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%PWaveVel0 (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%PWaveVel0 (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%PWaveVel0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%PWaveAcc0 (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%PWaveAcc0 (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%PWaveAcc0.', ErrStat,ErrMsg,RoutineName)
- IF (InitInp%MCFD > 0.0_ReKi) THEN ! MacCamy-Fuchs model
+ IF (WaveField%MCFD > 0.0_ReKi) THEN ! MacCamy-Fuchs model
- ALLOCATE ( PWaveAccC0HxiMCFPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0HxiMCFPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0HxiMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAccC0HyiMCFPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0HyiMCFPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0HyiMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAccC0VMCFPz0 (0:InitOut%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAccC0VMCFPz0 (0:WaveField%NStepWave2 ,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAccC0VMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0HxiMCFPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0HxiMCFPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0HxiMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0HyiMCFPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0HyiMCFPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0HyiMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( PWaveAcc0VMCFPz0 (0:InitOut%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
+ ALLOCATE ( PWaveAcc0VMCFPz0 (0:WaveField%NStepWave-1,InitInp%NWaveElevGrid), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array PWaveAcc0VMCFPz0.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveField%PWaveAccMCF0 (0:InitOut%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%PWaveAccMCF0 (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%PWaveAccMCF0.', ErrStat,ErrMsg,RoutineName)
END IF
@@ -949,18 +964,18 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Arrays for the Sin and Cos of the wave direction for each frequency. Used in calculating wave elevation, velocity, acceleration etc.
- ALLOCATE ( CosWaveDir( 0:InitOut%NStepWave2 ), STAT=ErrStatTmp )
+ ALLOCATE ( CosWaveDir( 0:WaveField%NStepWave2 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array CosWaveDir.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( SinWaveDir( 0:InitOut%NStepWave2 ), STAT=ErrStatTmp )
+ ALLOCATE ( SinWaveDir( 0:WaveField%NStepWave2 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array SinWaveDir.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( OmegaArr( 0:InitOut%NStepWave2 ), STAT=ErrStatTmp )
+ ALLOCATE ( OmegaArr( 0:WaveField%NStepWave2 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array OmegaArr.', ErrStat,ErrMsg,RoutineName)
! Arrays for the constrained wave
- ALLOCATE ( WaveS1SddArr( 0:InitOut%NStepWave2 ), STAT=ErrStatTmp )
+ ALLOCATE ( WaveS1SddArr( 0:WaveField%NStepWave2 ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveS1SddArr.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -973,8 +988,8 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Compute the positive-frequency components (including zero) of the discrete
! Fourier transforms of the wave kinematics:
- DO I = 0,InitOut%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
- OmegaArr(I) = I*InitOut%WaveDOmega
+ DO I = 0,WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
+ OmegaArr(I) = I*WaveField%WaveDOmega
END DO
call Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddArr)
@@ -989,8 +1004,8 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END IF
! Store the minimum and maximum wave directions
- InitOut%WaveDirMin = MINVAL(WaveField%WaveDirArr)
- InitOut%WaveDirMax = MAXVAL(WaveField%WaveDirArr)
+ WaveField%WaveDirMin = MINVAL(WaveField%WaveDirArr)
+ WaveField%WaveDirMax = MAXVAL(WaveField%WaveDirArr)
! Set the CosWaveDir and SinWaveDir arrays
@@ -999,7 +1014,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! make sure this is called before calling ConstrainedNewWaves
- CALL InitFFT ( InitOut%NStepWave, FFT_Data, .TRUE., ErrStatTmp )
+ CALL InitFFT ( WaveField%NStepWave, FFT_Data, .TRUE., ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -1010,7 +1025,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
!=== Constrained New Waves ===
! Modify the wave components to implement the constrained wave
! Only do this if WaveMod = 2 (JONSWAP/Pierson-Moskowitz Spectrum) and ConstWaveMod > 0
- IF ( InitInp%WaveMod == 2 .AND. InitInp%ConstWaveMod > 0) THEN
+ IF ( WaveField%WaveMod == WaveMod_JONSWAP .AND. InitInp%ConstWaveMod > 0) THEN
! adjust InitOut%WaveElevC0 for constrained wave:
call ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddArr, CosWaveDir, SinWaveDir, FFT_Data, ErrStatTmp, ErrMsgTmp)
call SetErrStat(ErrStatTmp,ErrMsgTmp, ErrStat,ErrMsg,RoutineName)
@@ -1031,12 +1046,12 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
CALL WrScr ( ' Adjusting incident wave kinematics for turbine offset from array origin.' )
- DO I = 0,InitOut%NStepWave2
+ DO I = 0,WaveField%NStepWave2
tmpComplex = CMPLX( WaveField%WaveElevC0(1,I), WaveField%WaveElevC0(2,I))
! some redundant calculations with later, but insignificant
- WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, InitInp%WtrDpth )
+ WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, WaveField%EffWtrDpth )
! apply the phase shift
tmpComplex = tmpComplex * EXP( -ImagNmbr*WaveNmbr*( InitInp%PtfmLocationX*CosWaveDir(I) + InitInp%PtfmLocationY*SinWaveDir(I) ))
@@ -1055,7 +1070,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
!! incident waves at each desired point on the still water level plane
!! where it can be output:
- DO I = 0,InitOut%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
+ DO I = 0,WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
! Set tmpComplex to the Ith element of the WAveElevC0 array
@@ -1069,12 +1084,12 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Compute the wavenumber:
- WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, InitInp%WtrDpth )
+ WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, WaveField%EffWtrDpth )
! Wavenumber-dependent acceleration scaling for MacCamy-Fuchs model
MCFC = 0.0_ReKi
- IF (InitInp%MCFD > 0.0_SiKi .AND. I>0_IntKi) THEN
- ka = 0.5_ReKi * WaveNmbr * InitInp%MCFD
+ IF (WaveField%MCFD > 0.0_SiKi .AND. I>0_IntKi) THEN
+ ka = 0.5_ReKi * WaveNmbr * WaveField%MCFD
JPrime = BESSEL_JN(1,ka) / ka - BESSEL_JN(2,ka)
YPrime = BESSEL_YN(1,ka) / ka - BESSEL_YN(2,ka)
HPrime = SQRT(JPrime*JPrime + YPrime*YPrime)
@@ -1090,18 +1105,18 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
WaveElevxiPrime0 = EXP( -ImagNmbr*WaveNmbr*( InitInp%WaveKinGridxi(WaveKinPrimeMap(J))*CosWaveDir(I) + &
InitInp%WaveKinGridyi(WaveKinPrimeMap(J))*SinWaveDir(I) ))
- WaveDynPC0 (I,J) = InitOut%RhoXg*tmpComplex*WaveElevxiPrime0 * COSHNumOvrCOSHDen ( WaveNmbr, InitInp%WtrDpth, WaveKinzi0Prime(J) )
+ WaveDynPC0 (I,J) = WaveField%RhoXg*tmpComplex*WaveElevxiPrime0 * COSHNumOvrCOSHDen ( WaveNmbr, WaveField%EffWtrDpth, WaveKinzi0Prime(J) )
- WaveVelC0Hxi (I,J) = CosWaveDir(I)*OmegaArr(I)*tmpComplex* WaveElevxiPrime0 * COSHNumOvrSINHDen ( WaveNmbr, InitInp%WtrDpth, WaveKinzi0Prime(J) )
- WaveVelC0Hyi (I,J) = SinWaveDir(I)*OmegaArr(I)*tmpComplex* WaveElevxiPrime0 * COSHNumOvrSINHDen ( WaveNmbr, InitInp%WtrDpth, WaveKinzi0Prime(J) )
+ WaveVelC0Hxi (I,J) = CosWaveDir(I)*OmegaArr(I)*tmpComplex* WaveElevxiPrime0 * COSHNumOvrSINHDen ( WaveNmbr, WaveField%EffWtrDpth, WaveKinzi0Prime(J) )
+ WaveVelC0Hyi (I,J) = SinWaveDir(I)*OmegaArr(I)*tmpComplex* WaveElevxiPrime0 * COSHNumOvrSINHDen ( WaveNmbr, WaveField%EffWtrDpth, WaveKinzi0Prime(J) )
- WaveVelC0V (I,J) = ImagOmega*tmpComplex* WaveElevxiPrime0 * SINHNumOvrSINHDen ( WaveNmbr, InitInp%WtrDpth, WaveKinzi0Prime(J) )
+ WaveVelC0V (I,J) = ImagOmega*tmpComplex* WaveElevxiPrime0 * SINHNumOvrSINHDen ( WaveNmbr, WaveField%EffWtrDpth, WaveKinzi0Prime(J) )
WaveAccC0Hxi (I,J) = ImagOmega* WaveVelC0Hxi (I,J)
WaveAccC0Hyi (I,J) = ImagOmega* WaveVelC0Hyi (I,J)
WaveAccC0V (I,J) = ImagOmega* WaveVelC0V (I,J)
- IF (InitInp%MCFD > 0.0_SiKi) THEN
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
WaveAccC0HxiMCF(I,J) = WaveAccC0Hxi(I,J) * MCFC
WaveAccC0HyiMCF(I,J) = WaveAccC0Hyi(I,J) * MCFC
WaveAccC0VMCF(I,J) = WaveAccC0V(I,J) * MCFC
@@ -1111,19 +1126,19 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END DO ! J - All points where the incident wave kinematics will be computed without stretching
!===================================
- IF (InitInp%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation wave stretching
+ IF (WaveField%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation wave stretching
DO J = 1,InitInp%NWaveElevGrid ! Loop through all points on the SWL
WaveElevxiPrime0 = EXP( -ImagNmbr*WaveNmbr*( InitInp%WaveKinGridxi(J)*CosWaveDir(I) + &
InitInp%WaveKinGridyi(J)*SinWaveDir(I) ))
! Partial derivatives at zi = 0
- PWaveDynPC0BPz0 (I,J) = InitOut%RhoXg* tmpComplex*WaveElevxiPrime0*WaveNmbr*TANH ( WaveNmbr*InitInp%WtrDpth )
+ PWaveDynPC0BPz0 (I,J) = WaveField%RhoXg* tmpComplex*WaveElevxiPrime0*WaveNmbr*TANH ( WaveNmbr*WaveField%EffWtrDpth )
PWaveVelC0HxiPz0(I,J) = CosWaveDir(I)*OmegaArr(I)*tmpComplex*WaveElevxiPrime0*WaveNmbr
PWaveVelC0HyiPz0(I,J) = SinWaveDir(I)*OmegaArr(I)*tmpComplex*WaveElevxiPrime0*WaveNmbr
IF (I == 0_IntKi) THEN ! Zero frequency component - Need to avoid division by zero.
PWaveVelC0VPz0 (I,J) = 0.0_ReKi
ELSE
- PWaveVelC0VPz0 (I,J) = ImagOmega*tmpComplex*WaveElevxiPrime0*WaveNmbr/TANH ( WaveNmbr*InitInp%WtrDpth )
+ PWaveVelC0VPz0 (I,J) = ImagOmega*tmpComplex*WaveElevxiPrime0*WaveNmbr/TANH ( WaveNmbr*WaveField%EffWtrDpth )
END IF
PWaveAccC0HxiPz0(I,J) = ImagOmega*PWaveVelC0HxiPz0(I,J)
@@ -1131,7 +1146,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
PWaveAccC0VPz0 (I,J) = ImagOmega*PWaveVelC0VPz0 (I,J)
- IF (InitInp%MCFD > 0.0_SiKi) THEN
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
PWaveAccC0HxiMCFPz0(I,J) = PWaveAccC0HxiPz0(I,J) * MCFC
PWaveAccC0HyiMCFPz0(I,J) = PWaveAccC0HyiPz0(I,J) * MCFC
PWaveAccC0VMCFPz0(I,J) = PWaveAccC0VPz0(I,J) * MCFC
@@ -1146,19 +1161,19 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Calculate the array of simulation times at which the instantaneous
! elevation of, velocity of, acceleration of, and loads associated with
! the incident waves are to be determined:
- DO I = 0,InitOut%NStepWave ! Loop through all time steps
+ DO I = 0,WaveField%NStepWave ! Loop through all time steps
WaveField%WaveTime(I) = I*REAL(InitInp%WaveDT,SiKi)
END DO ! I - All time steps
- DO I = 0,InitOut%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
+ DO I = 0,WaveField%NStepWave2 ! Loop through the positive frequency components (including zero) of the discrete Fourier transform
tmpComplexArr(I) = CMPLX(WaveField%WaveElevC0(1,I), WaveField%WaveElevC0(2,I))
END DO
! Compute the inverse discrete Fourier transforms to find the time-domain
! representations of the wave kinematics without stretcing:
- CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:InitOut%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
+ CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:WaveField%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while applying the FFT to WaveElev0.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -1211,7 +1226,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END DO ! J - All points where the incident wave kinematics will be computed without stretching
- IF (InitInp%MCFD > 0.0_SiKi) THEN
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
DO J = 1,NWaveKin0Prime ! Loop through all points where the incident wave kinematics will be computed without stretching
CALL ApplyFFT_cx ( WaveAcc0HxiMCF (:,J), WaveAccC0HxiMCF (:,J), FFT_Data, ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while applying the FFT to WaveAcc0HxiMCF.', ErrStat,ErrMsg,RoutineName)
@@ -1230,7 +1245,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END IF
!===================================
- IF (InitInp%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
+ IF (WaveField%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
DO J = 1,InitInp%NWaveElevGrid ! Loop through all points on the SWL where z-partial derivatives will be computed for extrapolated stretching
! FFT's of the partial derivatives
CALL ApplyFFT_cx ( PWaveDynP0BPz0(:,J ), PWaveDynPC0BPz0(:,J ), FFT_Data, ErrStatTmp )
@@ -1261,7 +1276,7 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
END DO ! J - All points where the incident wave kinematics will be computed without stretching
- IF (InitInp%MCFD > 0.0_SiKi) THEN ! MacCamy-Fuchs scaled acceleration field
+ IF (WaveField%MCFD > 0.0_SiKi) THEN ! MacCamy-Fuchs scaled acceleration field
DO J = 1,InitInp%NWaveElevGrid
CALL ApplyFFT_cx ( PWaveAcc0HxiMCFPz0 (:,J ), PWaveAccC0HxiMCFPz0(:,J ),FFT_Data, ErrStatTmp )
@@ -1340,8 +1355,6 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! mean sea level, the wave kinematics are zero:
! InitOut%PWaveDynP0(:,:,:,:) = 0.0
- ! InitOut%PWaveVel0 (:,:,:,:,:) = 0.0
- ! InitOut%PWaveAcc0 (:,:,:,:,:) = 0.0
primeCount = 1
count = 1
@@ -1354,9 +1367,9 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! jj = mod( (count-1) /InitInp%NGrid(1), InitInp%NGrid(2) ) + 1
! kk = (count-1) / (InitInp%NGrid(1)*InitInp%NGrid(2)) + 1
- IF ( ( InitInp%WaveKinGridzi(count) < -InitInp%WtrDpth ) .OR. ( InitInp%WaveKinGridzi(count) > 0.0 ) ) THEN
+ IF ( ( InitInp%WaveKinGridzi(count) < -WaveField%EffWtrDpth ) .OR. ( InitInp%WaveKinGridzi(count) > 0.0 ) ) THEN
! .TRUE. if the elevation of the point defined by WaveKinGridzi(J) lies below the seabed or above mean sea level (exclusive)
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
WaveField%WaveDynP(:,i,j,k ) = 0.0
WaveField%WaveVel (:,i,j,k,:) = 0.0
@@ -1365,13 +1378,13 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
ELSE
! The elevation of the point defined by WaveKinGridzi(J) must lie between the seabed and the mean sea level (inclusive)
- WaveField%WaveDynP(0:InitOut%NStepWave-1,i,j,k ) = WaveDynP0B( 0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveVel (0:InitOut%NStepWave-1,i,j,k,1) = WaveVel0Hxi(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveVel (0:InitOut%NStepWave-1,i,j,k,2) = WaveVel0Hyi(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveVel (0:InitOut%NStepWave-1,i,j,k,3) = WaveVel0V( 0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveAcc (0:InitOut%NStepWave-1,i,j,k,1) = WaveAcc0Hxi(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveAcc (0:InitOut%NStepWave-1,i,j,k,2) = WaveAcc0Hyi(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveAcc (0:InitOut%NStepWave-1,i,j,k,3) = WaveAcc0V( 0:InitOut%NStepWave-1,primeCount)
+ WaveField%WaveDynP(0:WaveField%NStepWave-1,i,j,k ) = WaveDynP0B( 0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveVel (0:WaveField%NStepWave-1,i,j,k,1) = WaveVel0Hxi(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveVel (0:WaveField%NStepWave-1,i,j,k,2) = WaveVel0Hyi(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveVel (0:WaveField%NStepWave-1,i,j,k,3) = WaveVel0V( 0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveAcc (0:WaveField%NStepWave-1,i,j,k,1) = WaveAcc0Hxi(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveAcc (0:WaveField%NStepWave-1,i,j,k,2) = WaveAcc0Hyi(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveAcc (0:WaveField%NStepWave-1,i,j,k,3) = WaveAcc0V( 0:WaveField%NStepWave-1,primeCount)
primeCount = primeCount + 1
END IF
count = count + 1
@@ -1380,21 +1393,21 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
end do
! MacCamy-Fuchs scaled fluid acceleration
- IF (InitInp%MCFD > 0.0_SiKi) THEN
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
primeCount = 1
count = 1
do k = 1, InitInp%NGrid(3)
do j = 1, InitInp%NGrid(2)
do i = 1, InitInp%NGrid(1)
- IF ( ( InitInp%WaveKinGridzi(count) < -InitInp%WtrDpth ) .OR. ( InitInp%WaveKinGridzi(count) > 0.0 ) ) THEN
+ IF ( ( InitInp%WaveKinGridzi(count) < -WaveField%EffWtrDpth ) .OR. ( InitInp%WaveKinGridzi(count) > 0.0 ) ) THEN
! .TRUE. if the elevation of the point defined by WaveKinGridzi(J) lies below the seabed or above mean sea level (exclusive)
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
WaveField%WaveAccMCF(:,i,j,k,:) = 0.0
ELSE
! The elevation of the point defined by WaveKinGridzi(J) must lie between the seabed and the mean sea level (inclusive)
- WaveField%WaveAccMCF (0:InitOut%NStepWave-1,i,j,k,1) = WaveAcc0HxiMCF(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveAccMCF (0:InitOut%NStepWave-1,i,j,k,2) = WaveAcc0HyiMCF(0:InitOut%NStepWave-1,primeCount)
- WaveField%WaveAccMCF (0:InitOut%NStepWave-1,i,j,k,3) = WaveAcc0VMCF( 0:InitOut%NStepWave-1,primeCount)
+ WaveField%WaveAccMCF (0:WaveField%NStepWave-1,i,j,k,1) = WaveAcc0HxiMCF(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveAccMCF (0:WaveField%NStepWave-1,i,j,k,2) = WaveAcc0HyiMCF(0:WaveField%NStepWave-1,primeCount)
+ WaveField%WaveAccMCF (0:WaveField%NStepWave-1,i,j,k,3) = WaveAcc0VMCF( 0:WaveField%NStepWave-1,primeCount)
primeCount = primeCount + 1
END IF
count = count + 1
@@ -1403,29 +1416,29 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
end do
END IF
- IF (InitInp%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
+ IF (WaveField%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
primeCount = 1
DO j = 1, InitInp%NGrid(2) ! Loop through all points on the SWL where partial derivatives about z were computed
DO i = 1, InitInp%NGrid(1)
- WaveField%PWaveDynP0(0:InitOut%NStepWave-1,i,j ) = PWaveDynP0BPz0( 0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveVel0 (0:InitOut%NStepWave-1,i,j,1) = PWaveVel0HxiPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveVel0 (0:InitOut%NStepWave-1,i,j,2) = PWaveVel0HyiPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveVel0 (0:InitOut%NStepWave-1,i,j,3) = PWaveVel0VPz0( 0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveAcc0 (0:InitOut%NStepWave-1,i,j,1) = pWaveAcc0HxiPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveAcc0 (0:InitOut%NStepWave-1,i,j,2) = pWaveAcc0HyiPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveAcc0 (0:InitOut%NStepWave-1,i,j,3) = PWaveAcc0VPz0( 0:InitOut%NStepWave-1,primeCount)
+ WaveField%PWaveDynP0(0:WaveField%NStepWave-1,i,j ) = PWaveDynP0BPz0( 0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveVel0 (0:WaveField%NStepWave-1,i,j,1) = PWaveVel0HxiPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveVel0 (0:WaveField%NStepWave-1,i,j,2) = PWaveVel0HyiPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveVel0 (0:WaveField%NStepWave-1,i,j,3) = PWaveVel0VPz0( 0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveAcc0 (0:WaveField%NStepWave-1,i,j,1) = pWaveAcc0HxiPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveAcc0 (0:WaveField%NStepWave-1,i,j,2) = pWaveAcc0HyiPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveAcc0 (0:WaveField%NStepWave-1,i,j,3) = PWaveAcc0VPz0( 0:WaveField%NStepWave-1,primeCount)
primeCount = primeCount + 1
END DO
END DO
- IF (InitInp%MCFD > 0.0_SiKi) THEN
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
primeCount = 1
DO j = 1, InitInp%NGrid(2) ! Loop through all points on the SWL where partial derivatives about z were computed
DO i = 1, InitInp%NGrid(1)
- WaveField%PWaveAccMCF0 (0:InitOut%NStepWave-1,i,j,1) = pWaveAcc0HxiMCFPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveAccMCF0 (0:InitOut%NStepWave-1,i,j,2) = pWaveAcc0HyiMCFPz0(0:InitOut%NStepWave-1,primeCount)
- WaveField%PWaveAccMCF0 (0:InitOut%NStepWave-1,i,j,3) = PWaveAcc0VMCFPz0( 0:InitOut%NStepWave-1,primeCount)
+ WaveField%PWaveAccMCF0 (0:WaveField%NStepWave-1,i,j,1) = pWaveAcc0HxiMCFPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveAccMCF0 (0:WaveField%NStepWave-1,i,j,2) = pWaveAcc0HyiMCFPz0(0:WaveField%NStepWave-1,primeCount)
+ WaveField%PWaveAccMCF0 (0:WaveField%NStepWave-1,i,j,3) = PWaveAcc0VMCFPz0( 0:WaveField%NStepWave-1,primeCount)
primeCount = primeCount + 1
END DO
END DO
@@ -1483,20 +1496,20 @@ SUBROUTINE VariousWaves_Init ( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! ENDSELECT
! Set the ending timestep to the same as the first timestep
- WaveField%WaveElev0 (InitOut%NStepWave) = WaveField%WaveElev0 (0 )
- WaveField%WaveDynP (InitOut%NStepWave,:,:,: ) = WaveField%WaveDynP (0,:,:,: )
- WaveField%WaveVel (InitOut%NStepWave,:,:,:,:) = WaveField%WaveVel (0,:,:,:,:)
- WaveField%WaveAcc (InitOut%NStepWave,:,:,:,:) = WaveField%WaveAcc (0,:,:,:,:)
- IF (InitInp%MCFD > 0.0_SiKi) THEN
- WaveField%WaveAccMCF (InitOut%NStepWave,:,:,:,:) = WaveField%WaveAccMCF(0,:,:,:,:)
+ WaveField%WaveElev0 (WaveField%NStepWave) = WaveField%WaveElev0 (0 )
+ WaveField%WaveDynP (WaveField%NStepWave,:,:,: ) = WaveField%WaveDynP (0,:,:,: )
+ WaveField%WaveVel (WaveField%NStepWave,:,:,:,:) = WaveField%WaveVel (0,:,:,:,:)
+ WaveField%WaveAcc (WaveField%NStepWave,:,:,:,:) = WaveField%WaveAcc (0,:,:,:,:)
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
+ WaveField%WaveAccMCF (WaveField%NStepWave,:,:,:,:) = WaveField%WaveAccMCF(0,:,:,:,:)
END IF
- IF (InitInp%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
- WaveField%PWaveDynP0(InitOut%NStepWave,:,: ) = WaveField%PWaveDynP0(0,:,: )
- WaveField%PWaveVel0 (InitOut%NStepWave,:,:,:) = WaveField%PWaveVel0 (0,:,:,:)
- WaveField%PWaveAcc0 (InitOut%NStepWave,:,:,:) = WaveField%PWaveAcc0 (0,:,:,:)
- IF (InitInp%MCFD > 0.0_SiKi) THEN
- WaveField%PWaveAccMCF0 (InitOut%NStepWave,:,:,:) = WaveField%PWaveAccMCF0(0,:,:,:)
+ IF (WaveField%WaveStMod .EQ. 2_IntKi) THEN ! Extrapolation Wave Stretching
+ WaveField%PWaveDynP0(WaveField%NStepWave,:,: ) = WaveField%PWaveDynP0(0,:,: )
+ WaveField%PWaveVel0 (WaveField%NStepWave,:,:,:) = WaveField%PWaveVel0 (0,:,:,:)
+ WaveField%PWaveAcc0 (WaveField%NStepWave,:,:,:) = WaveField%PWaveAcc0 (0,:,:,:)
+ IF (WaveField%MCFD > 0.0_SiKi) THEN
+ WaveField%PWaveAccMCF0 (WaveField%NStepWave,:,:,:) = WaveField%PWaveAccMCF0(0,:,:,:)
END IF
END IF
@@ -1510,9 +1523,9 @@ SUBROUTINE WaveElevTimeSeriesAtXY(Xcoord,Ycoord, WaveElevAtXY, WaveElevCAtXY, tm
REAL(SiKi), INTENT(IN ) :: Xcoord
REAL(SiKi), INTENT(IN ) :: Ycoord
- REAL(SiKi), INTENT( OUT) :: WaveElevAtXY(0:InitOut%NStepWave)
- real(SiKi), INTENT( OUT) :: WaveElevCAtXY(2,0:InitOut%NStepWave2)
- COMPLEX(SiKi), INTENT(INOUT) :: tmpComplexArr(0:InitOut%NStepWave2) ! A temporary array (0:NStepWave2-1) for FFT use.
+ REAL(SiKi), INTENT( OUT) :: WaveElevAtXY(0:WaveField%NStepWave)
+ real(SiKi), INTENT( OUT) :: WaveElevCAtXY(2,0:WaveField%NStepWave2)
+ COMPLEX(SiKi), INTENT(INOUT) :: tmpComplexArr(0:WaveField%NStepWave2) ! A temporary array (0:NStepWave2-1) for FFT use.
INTEGER(IntKi), INTENT( OUT) :: ErrStatLcl
CHARACTER(*), INTENT( OUT) :: ErrMsgLcl
@@ -1528,22 +1541,22 @@ SUBROUTINE WaveElevTimeSeriesAtXY(Xcoord,Ycoord, WaveElevAtXY, WaveElevCAtXY, tm
tmpComplexArr = CMPLX(0.0_SiKi,0.0_SiKi)
! Loop through the positive frequency components (including zero).
- DO I = 0,InitOut%NStepWave2
+ DO I = 0,WaveField%NStepWave2
- WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, InitInp%WtrDpth )
+ WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, WaveField%EffWtrDpth )
tmpComplexArr(I) = CMPLX( WaveField%WaveElevC0(1,I), WaveField%WaveElevC0(2,I)) * &
EXP( -ImagNmbr*WaveNmbr*( Xcoord*CosWaveDir(I)+ &
Ycoord*SinWaveDir(I) ) )
ENDDO
- CALL ApplyFFT_cx ( WaveElevAtXY(0:InitOut%NStepWave-1), tmpComplexArr, FFT_Data, ErrStatLcl2 )
+ CALL ApplyFFT_cx ( WaveElevAtXY(0:WaveField%NStepWave-1), tmpComplexArr, FFT_Data, ErrStatLcl2 )
CALL SetErrStat(ErrStatLcl2,'Error occured while applying the FFT.',ErrStatLcl,ErrMsgLcl,'WaveElevTimeSeriesAtXY')
WaveElevCAtXY( 1,: ) = REAL(tmpComplexArr(:))
WaveElevCAtXY( 2,: ) = AIMAG(tmpComplexArr(:))
! Append first datpoint as the last as aid for repeated wave data
- WaveElevAtXY(InitOut%NStepWave) = WaveElevAtXY(0)
+ WaveElevAtXY(WaveField%NStepWave) = WaveElevAtXY(0)
END SUBROUTINE WaveElevTimeSeriesAtXY
@@ -1630,10 +1643,6 @@ SUBROUTINE Waves_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Local Variables:
INTEGER(IntKi) :: ErrStatTmp ! Temporary error status for processing
CHARACTER(ErrMsgLen) :: ErrMsgTmp ! Temporary error message for procesing
-! REAL(ReKi), ALLOCATABLE :: tmpWaveKinzi(:)
-
-! TYPE(FFT_DataType) :: FFT_Data ! the instance of the FFT module we're using
-
! Initialize ErrStat
@@ -1650,20 +1659,14 @@ SUBROUTINE Waves_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Define initialization-routine output here:
- !InitOut%WriteOutputHdr = (/ 'Time', 'Column2' /)
- !InitOut%WriteOutputUnt = (/ '(s)', '(-)' /)
-
- InitOut%RhoXg = InitInp%WtrDens*InitInp%Gravity
-
-
! Initialize the variables associated with the incident wave:
- SELECT CASE ( InitInp%WaveMod ) ! Which incident wave kinematics model are we using?
+ SELECT CASE ( WaveField%WaveMod ) ! Which incident wave kinematics model are we using?
- CASE ( 0 ) ! None=still water.
+ CASE ( WaveMod_None ) ! None=still water.
CALL StillWaterWaves_Init( InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp )
CALL SetErrStat(ErrStatTmp,ErrMsgTmp,ErrStat,ErrMsg,'Waves_Init')
@@ -1671,7 +1674,7 @@ SUBROUTINE Waves_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
- CASE ( 1, 2, 3, 4, 10 ) ! 1, 10: Plane progressive (regular) wave, 2: JONSWAP/Pierson-Moskowitz spectrum (irregular) wave, 3: white-noise, or 4: user-defined spectrum (irregular) wave.
+ CASE ( WaveMod_Regular, WaveMod_JONSWAP, WaveMod_WhiteNoise, WaveMod_UserSpctrm, WaveMod_RegularUsrPh ) ! 1, 10: Plane progressive (regular) wave, 2: JONSWAP/Pierson-Moskowitz spectrum (irregular) wave, 3: white-noise, or 4: user-defined spectrum (irregular) wave.
! Now call the init with all the zi locations for the Morrison member nodes
CALL VariousWaves_Init( InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp )
@@ -1679,7 +1682,7 @@ SUBROUTINE Waves_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
IF ( ErrStat >= AbortErrLev ) RETURN
- CASE ( 5 ) ! User-supplied wave elevation time history; HD derives full wave kinematics from this elevation time series data.
+ CASE ( WaveMod_ExtElev ) ! User-supplied wave elevation time history; HD derives full wave kinematics from this elevation time series data.
! Get the wave frequency information from the file (by FFT of the elevation)
CALL UserWaveElevations_Init( InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp )
@@ -1692,13 +1695,13 @@ SUBROUTINE Waves_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
IF ( ErrStat >= AbortErrLev ) RETURN
- CASE ( 6 ) ! User-supplied wave kinematics data.
+ CASE ( WaveMod_ExtFull ) ! User-supplied wave kinematics data.
CALL UserWaves_Init( InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp )
CALL SetErrStat(ErrStatTmp,ErrMsgTmp,ErrStat,ErrMsg,'Waves_Init')
IF ( ErrStat >= AbortErrLev ) RETURN
- CASE ( 7 )
+ CASE ( WaveMod_UserFreq )
! Get the wave frequency information from the file (by reading in wave frequency components)
CALL UserWaveComponents_Init( InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp )
@@ -1798,9 +1801,10 @@ FUNCTION WheelerStretching ( zOrzPrime, Zeta, h, ForwardOrBackward, ErrStat, Err
END FUNCTION WheelerStretching
!------------------------------------------------------------------------------------------------------------------------
-SUBROUTINE CalculateWaveNDir(InitInp, InitOut, ErrStat, ErrMsg)
+SUBROUTINE CalculateWaveNDir(InitInp, InitOut, WaveField, ErrStat, ErrMsg)
TYPE(Waves_InitInputType), INTENT(IN ) :: InitInp ! Input data for initialization routine
TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut ! Output data
+ TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None
@@ -1840,7 +1844,7 @@ SUBROUTINE CalculateWaveNDir(InitInp, InitOut, ErrStat, ErrMsg)
ErrStatTmp = ErrID_None
ErrMsgTmp = ""
- DO WHILE ( .NOT. EqualRealNos( REAL(InitOut%NStepWave2/InitOut%WaveNDir), REAL(InitOut%NStepWave2)/REAL(InitOut%WaveNDir) ))
+ DO WHILE ( .NOT. EqualRealNos( REAL(WaveField%NStepWave2/InitOut%WaveNDir), REAL(WaveField%NStepWave2)/REAL(InitOut%WaveNDir) ))
IF (InitOut%WaveNDir > WaveNDirMax ) THEN
ErrMsgTmp = 'Could not find value for WaveNDir between '//TRIM(Num2LStr(InitInp%WaveNDir))//' and '// &
@@ -1874,9 +1878,9 @@ SUBROUTINE CalculateWaveNDir(InitInp, InitOut, ErrStat, ErrMsg)
! Now check for the possible values of WaveNDir (up to I=5) so that we can tell the user about it.
I = 0
ErrMsgTmp = 'The next values of WaveNDir that work with the selected values for WaveTMax and WaveDT:'
- DO WHILE ( InitOut%WaveNDir <= INT(InitOut%NStepWave2/4.0) )
- IF ( EqualRealNos(REAL(InitOut%NStepWave2/InitOut%WaveNDir), &
- REAL(InitOut%NStepWave2)/REAL(InitOut%WaveNDir) )) THEN
+ DO WHILE ( InitOut%WaveNDir <= INT(WaveField%NStepWave2/4.0) )
+ IF ( EqualRealNos(REAL(WaveField%NStepWave2/InitOut%WaveNDir), &
+ REAL(WaveField%NStepWave2)/REAL(InitOut%WaveNDir) )) THEN
ErrMsgTmp = TRIM(ErrMsgTmp)//" "//TRIM(Num2LStr(InitOut%WaveNDir))
I = I + 1
IF (I >= 5) EXIT ! limit the number of choices for WaveNDir that are printed
@@ -1888,7 +1892,7 @@ SUBROUTINE CalculateWaveNDir(InitInp, InitOut, ErrStat, ErrMsg)
! If there were no additional values for WaveNDir found, I will be 0, so we rewrite the error message.
IF ( I == 0 ) THEN
ErrMsgTmp = 'There are no values for WaveNDir between '//TRIM(Num2LStr(WaveNDirMax))//' and '// &
- TRIM(Num2LStr(INT(InitOut%NStepWave2/4.0)))//' (4 frequencies per wave direction)'// &
+ TRIM(Num2LStr(INT(WaveField%NStepWave2/4.0)))//' (4 frequencies per wave direction)'// &
' that will work with the selected values for WaveTMax ('//TRIM(Num2Lstr(InitOut%WaveTMax))// &
') and WaveDT ('//TRIM(Num2LStr(InitInp%WaveDT))//'). Change either WaveTMax or WaveDT.'
ELSE
@@ -1934,15 +1938,15 @@ SUBROUTINE CalculateWaveDirection(InitInp, InitOut, WaveField, ErrStat, ErrMsg )
ErrMsg = ""
- IF (InitInp%WaveMod == 7) THEN ! wavemod 0 and 6 aren't called from this routine, but they fall into this case, too
+ IF (WaveField%WaveMod == WaveMod_UserFreq) THEN ! wavemod 0 (WaveMod_None) and 6 (WaveMod_ExtFull) aren't called from this routine, but they fall into this case, too
RETURN
!InitOut%WaveDirArr set in UserWaveComponents_Init for WaveMod 7
- !InitOut%WaveDirArr = 0, set in Initial_InitOut_Arrays for WaveMod 0 and 6
+ !InitOut%WaveDirArr = 0, set in Initial_InitOut_Arrays for WaveMod 0 and 6 (WaveMod_ExtFull)
- ELSEIF(.not. InitInp%WaveMultiDir .or. InitInp%WaveNDir <= 1) THEN ! we have a single wave direction
+ ELSEIF(.not. WaveField%WaveMultiDir .or. InitInp%WaveNDir <= 1) THEN ! we have a single wave direction
- WaveField%WaveDirArr = InitInp%WaveDir
+ WaveField%WaveDirArr = WaveField%WaveDir
ELSE ! multi directional waves
@@ -1969,7 +1973,7 @@ SUBROUTINE CalculateWaveDirection(InitInp, InitOut, WaveField, ErrStat, ErrMsg )
!! of smallish numbers.
! this sets InitOut%WaveNDir:
- call CalculateWaveNDir(InitInp, InitOut, ErrStatTmp, ErrMsgTmp)
+ call CalculateWaveNDir(InitInp, InitOut, WaveField, ErrStatTmp, ErrMsgTmp)
call SetErrStat(ErrStatTmp,ErrMsgTmp,ErrStat,ErrMsg,RoutineName)
if (ErrStat >= AbortErrLev) then
call Cleanup()
@@ -1978,7 +1982,7 @@ SUBROUTINE CalculateWaveDirection(InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! This allocates and sets WvTheta:
- call CalculateWaveSpreading(InitInp, InitOut, WvTheta, ErrStatTmp, ErrMsgTmp)
+ call CalculateWaveSpreading(InitInp, InitOut, WaveField, WvTheta, ErrStatTmp, ErrMsgTmp)
call SetErrStat(ErrStatTmp,ErrMsgTmp,ErrStat,ErrMsg,RoutineName)
if (ErrStat >= AbortErrLev) then
call Cleanup()
@@ -2013,7 +2017,7 @@ SUBROUTINE CalculateWaveDirection(InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! K should be exactly NStepWave2 when done assigning directions. The the Omega = 0 has
! no amplitude, but gets a direction anyhow (to simplify the calculation of WaveNDir).
- WvSpreadFreqPerDir = (InitOut%NStepWave2)/InitOut%WaveNDir
+ WvSpreadFreqPerDir = (WaveField%NStepWave2)/InitOut%WaveNDir
K = 0
! Work through the frequencies in groups of directions.
DO I = 1,WvSpreadFreqPerDir
@@ -2045,7 +2049,7 @@ SUBROUTINE CalculateWaveDirection(InitInp, InitOut, WaveField, ErrStat, ErrMsg )
! Perform a quick sanity check. We should have assigned all wave frequencies a direction, so K should be
! K = NStepWave2 (K is incrimented afterwards).
- IF ( K /= (InitOut%NStepWave2 ) ) THEN
+ IF ( K /= (WaveField%NStepWave2 ) ) THEN
CALL SetErrStat(ErrID_Fatal, 'Something went wrong while assigning wave directions.',ErrStat,ErrMsg,RoutineName)
CALL CleanUp()
RETURN
@@ -2066,12 +2070,13 @@ END SUBROUTINE Cleanup
END SUBROUTINE CalculateWaveDirection
!------------------------------------------------------------------------------------------------------------------------
-SUBROUTINE CalculateWaveSpreading(InitInp, InitOut, WvTheta, ErrStat, ErrMsg )
+SUBROUTINE CalculateWaveSpreading(InitInp, InitOut, WaveField, WvTheta, ErrStat, ErrMsg )
! Compute the wave direction array
!----------------------------------------------------------------------------------------------------------------------------------
TYPE(Waves_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine
TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut !< Output data
+ TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
REAL(SiKi), ALLOCATABLE, INTENT( OUT) :: WvTheta(:) !< Final set of wave directions (degrees)
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
@@ -2171,10 +2176,10 @@ SUBROUTINE CalculateWaveSpreading(InitInp, InitOut, WvTheta, ErrStat, ErrMsg )
!> 2. Calculate the spreading function as a function of angle. Step through all _WvSpreadNDir_ steps.
DO I=0,WvSpreadNDir
! The current angle as we step through the range
- WvSpreadThetas(I) = I*WvSpreadDTheta + InitInp%WaveDir - InitInp%WaveDirRange/(2.0_SiKi)
+ WvSpreadThetas(I) = I*WvSpreadDTheta + WaveField%WaveDir - InitInp%WaveDirRange/(2.0_SiKi)
! Calculate the wave spreading for the current value of WvSpreadThetas
- WvSpreadCos2SArr(I) = WvSpreadCos2SConst*abs( cos(Pi*(WvSpreadThetas(I)-InitInp%WaveDir)/InitInp%WaveDirRange) ) **(2*InitInp%WaveDirSpread)
+ WvSpreadCos2SArr(I) = WvSpreadCos2SConst*abs( cos(Pi*(WvSpreadThetas(I)-WaveField%WaveDir)/InitInp%WaveDirRange) ) **(2*InitInp%WaveDirSpread)
!> 3. Calculate the integral of the spreading function up to the current angle and save it.
! Remember that the first element can't refer to one before it.
@@ -2226,10 +2231,10 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
TYPE(Waves_InitInputType), INTENT(IN ) :: InitInp ! Input data for initialization routine
TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut ! Output data
TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
- REAL(SiKi), INTENT(IN ) :: OmegaArr(0:InitOut%NStepWave2) !< Array of all non-negative angular frequencies (rad/s)
- REAL(SiKi), INTENT( OUT) :: WaveS1SddArr(0:InitOut%NStepWave2) !< One-sided power spectral density of the wave spectrum at all non-negative frequencies (m^2/(rad/s))
+ REAL(SiKi), INTENT(IN ) :: OmegaArr(0:WaveField%NStepWave2) !< Array of all non-negative angular frequencies (rad/s)
+ REAL(SiKi), INTENT( OUT) :: WaveS1SddArr(0:WaveField%NStepWave2) !< One-sided power spectral density of the wave spectrum at all non-negative frequencies (m^2/(rad/s))
- COMPLEX(SiKi) :: WGNC(0:InitOut%NStepWave2) ! Discrete Fourier transform of the realization of a White Gaussian Noise (WGN) time series process with unit variance for the current frequency component (-)
+ COMPLEX(SiKi) :: WGNC(0:WaveField%NStepWave2) ! Discrete Fourier transform of the realization of a White Gaussian Noise (WGN) time series process with unit variance for the current frequency component (-)
INTEGER :: I ! Loop counter
INTEGER :: I_WaveTp ! The index of the frequency component nearest to WaveTp
REAL(SiKi) :: SQRTNStepWave2 ! SQRT( NStepWave/2 )
@@ -2237,12 +2242,12 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
REAL(SiKi) :: WaveS2Sdd ! Two-sided power spectral density of the wave spectrum per unit time for the current frequency component (m^2/(rad/s))
- IF ( InitInp%WaveMod == 5 .OR. InitInp%WaveMod == 7) THEN ! Wave elevation or frequency component data read in
+ IF ( WaveField%WaveMod == WaveMod_ExtElev .OR. WaveField%WaveMod == WaveMod_UserFreq) THEN ! Wave elevation or frequency component data read in (5 or 7)
- DO I = 0,InitOut%NStepWave2
+ DO I = 0,WaveField%NStepWave2
! Apply limits to the existing WaveElevC0 arrays if outside frequency range
- IF ( OmegaArr(I) < InitInp%WvLowCOff .OR. OmegaArr(I) > InitInp%WvHiCOff ) THEN
+ IF ( OmegaArr(I) < WaveField%WvLowCOff .OR. OmegaArr(I) > WaveField%WvHiCOff ) THEN
WaveField%WaveElevC0(:,I) = 0.0_SiKi
ENDIF
@@ -2254,7 +2259,7 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
END IF
- I_WaveTp = NINT ( TwoPi/(InitOut%WaveDOmega*InitInp%WaveTp) ) ! Compute the index of the frequency component nearest to WaveTp. Note, we don't check if it's a valid index into the arrays
+ I_WaveTp = NINT ( TwoPi/(WaveField%WaveDOmega*InitInp%WaveTp) ) ! Compute the index of the frequency component nearest to WaveTp. Note, we don't check if it's a valid index into the arrays
! Compute the discrete Fourier transform of the realization of a White
! Gaussian Noise (WGN) time series process with unit variance:
@@ -2266,18 +2271,18 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
! OmegaArr(I) == 0.0 and OmegaArr(I) == NStepWave2*WaveDOmega (= WaveOmegaMax)
! must be zero.
!---------------------------------
- ! I == 1 or InitOut%NStepWave2 if ( OmegaArr(I) == 0.0 ) or ( OmegaArr(I) == NStepWave2*WaveDOmega (= WaveOmegaMax) )
+ ! I == 1 or WaveField%NStepWave2 if ( OmegaArr(I) == 0.0 ) or ( OmegaArr(I) == NStepWave2*WaveDOmega (= WaveOmegaMax) )
WGNC(1) = (0.0,0.0)
- WGNC(InitOut%NStepWave2) = (0.0,0.0)
+ WGNC(WaveField%NStepWave2) = (0.0,0.0)
- IF ( InitInp%WaveMod == 10 ) THEN ! .TRUE. for plane progressive (regular) waves with a specified phase
- DO I = 0,InitOut%NStepWave2-1 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
+ IF ( WaveField%WaveMod == WaveMod_RegularUsrPh ) THEN ! .TRUE. for plane progressive (regular) waves with a specified phase
+ DO I = 0,WaveField%NStepWave2-1 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
IF (I==1) CYCLE
WGNC(I) = BoxMuller ( InitInp%RNG%pRNG, InitInp%WaveNDAmp, InitInp%WavePhase )
END DO
ELSE ! All other OmegaArr(I)
- DO I = 0,InitOut%NStepWave2-1 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
+ DO I = 0,WaveField%NStepWave2-1 ! Loop through the positive frequency components (including zero) of the discrete Fourier transforms
IF (I==1) CYCLE
WGNC(I) = BoxMuller ( InitInp%RNG%pRNG, InitInp%WaveNDAmp )
@@ -2288,10 +2293,10 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
! For (WaveMod=1 plane progressive (regular); and WaveMod=10 plane progressive (regular) waves with a specified phase)
! adjust WGNC and set PSD at specified frequency
!------------------------------------
- IF (InitInp%WaveMod == 10 .or. InitInp%WaveMod == 1) THEN
+ IF (WaveField%WaveMod == WaveMod_RegularUsrPh .or. WaveField%WaveMod == WaveMod_Regular) THEN !10 or 1
WaveS1SddArr = 0.0
- IF (I_WaveTp < InitOut%NStepWave2 .and. (I_WaveTp > 1 .or. I_WaveTp == 0) ) THEN
+ IF (I_WaveTp < WaveField%NStepWave2 .and. (I_WaveTp > 1 .or. I_WaveTp == 0) ) THEN
! This scaling of WGNC is used to ensure that the Box-Muller method is only providing a random phase,
! not a magnitude change, at the frequency of the plane progressive wave. The SQRT(2.0) is used to
@@ -2302,14 +2307,14 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
WGNC(I_WaveTp) = WGNC(I_WaveTp) * ( SQRT(2.0_SiKi) / ABS(WGNC(I_WaveTp)) )
! Plane progressive (regular) wave; the wave spectrum is an impulse function centered on frequency component closest to WaveTp.
- WaveS1SddArr(I_WaveTp) = 0.5_SiKi * (InitInp%WaveHs/2.0_SiKi)**2 / InitOut%WaveDOmega
+ WaveS1SddArr(I_WaveTp) = 0.5_SiKi * (InitInp%WaveHs/2.0_SiKi)**2 / WaveField%WaveDOmega
END IF
ELSE
- DO I = 0,InitOut%NStepWave2
+ DO I = 0,WaveField%NStepWave2
- IF ( OmegaArr(I) < InitInp%WvLowCOff .OR. OmegaArr(I) > InitInp%WvHiCOff ) THEN ! .TRUE. if OmegaArr(I) is above or below the cut-off frequency
+ IF ( OmegaArr(I) < WaveField%WvLowCOff .OR. OmegaArr(I) > WaveField%WvHiCOff ) THEN ! .TRUE. if OmegaArr(I) is above or below the cut-off frequency
! Zero-out the wave spectrum above the cut-off frequency. We must cut-off the frequency in order to
! void nonphysical wave forces. Waves that have wavelengths much smaller than the platform diameter
! (high frequency) do not contribute to the net force because regions of positive and negative
@@ -2319,13 +2324,13 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
ELSE
- SELECT CASE ( InitInp%WaveMod ) ! Which incident wave kinematics model are we using?
- CASE ( 2 ) ! JONSWAP/Pierson-Moskowitz spectrum (irregular) wave.
+ SELECT CASE ( WaveField%WaveMod ) ! Which incident wave kinematics model are we using?
+ CASE ( WaveMod_JONSWAP ) ! JONSWAP/Pierson-Moskowitz spectrum (irregular) wave.
WaveS1SddArr(I) = JONSWAP ( OmegaArr(I), InitInp%WaveHs, InitInp%WaveTp, InitInp%WavePkShp )
- CASE ( 3 ) ! White-noise
- WaveS1SddArr(I) = InitInp%WaveHs * InitInp%WaveHs / ( 16.0 * (InitInp%WvHiCOff - InitInp%WvLowCOff) )
- CASE ( 4 ) ! User-defined spectrum (irregular) wave.
- CALL UserWaveSpctrm ( OmegaArr(I), InitInp%WaveDir, InitInp%DirRoot, WaveS1SddArr(I) )
+ CASE ( WaveMod_WhiteNoise ) ! White-noise
+ WaveS1SddArr(I) = InitInp%WaveHs * InitInp%WaveHs / ( 16.0 * (WaveField%WvHiCOff - WaveField%WvLowCOff) )
+ CASE ( WaveMod_UserSpctrm ) ! User-defined spectrum (irregular) wave.
+ CALL UserWaveSpctrm ( OmegaArr(I), WaveField%WaveDir, InitInp%DirRoot, WaveS1SddArr(I) )
ENDSELECT
END IF
@@ -2340,9 +2345,9 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
! Compute the one-sided power spectral density of the wave spectrum per unit
! time; zero-out the wave spectrum above the cut-off frequency:
!---------------------------------
- SQRTNStepWave2 = SQRT( REAL( InitOut%NStepWave2, SiKi ) ) ! Compute SQRT( NStepWave/2 ).
+ SQRTNStepWave2 = SQRT( REAL( WaveField%NStepWave2, SiKi ) ) ! Compute SQRT( NStepWave/2 ).
- DO I = 0,InitOut%NStepWave2
+ DO I = 0,WaveField%NStepWave2
! Compute the two-sided power spectral density of the wave spectrum per unit
! time:
@@ -2358,16 +2363,16 @@ SUBROUTINE Get_1Spsd_and_WaveElevC0(InitInp, InitOut, WaveField, OmegaArr, WaveS
END SUBROUTINE Get_1Spsd_and_WaveElevC0
!------------------------------------------------------------------------------------------------------------------------
-!> update InitOut%WaveElevC0; call InitFFT before calling this routine!
+!> update WaveField%WaveElevC0; call InitFFT before calling this routine!
SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddArr, CosWaveDir, SinWaveDir, FFT_Data, ErrStat, ErrMsg)
TYPE(Waves_InitInputType), INTENT(IN ) :: InitInp ! Input data for initialization routine
TYPE(Waves_InitOutputType), INTENT(INOUT) :: InitOut ! Output data
TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField
- REAL(SiKi), INTENT(IN ) :: OmegaArr(0:InitOut%NStepWave2) !< Array of all non-negative angular frequencies (rad/s)
- REAL(SiKi), INTENT(IN ) :: WaveS1SddArr(0:InitOut%NStepWave2) !< One-sided power spectral density of the wave spectrum at all non-negative frequencies (m^2/(rad/s))
- REAL(SiKi), INTENT(IN ) :: CosWaveDir(0:InitOut%NStepWave2) !< COS( WaveDirArr(I) ) -- Each wave frequency has a unique wave direction
- REAL(SiKi), INTENT(IN ) :: SinWaveDir(0:InitOut%NStepWave2) !< SIN( WaveDirArr(I) ) -- Each wave frequency has a unique wave direction
+ REAL(SiKi), INTENT(IN ) :: OmegaArr(0:WaveField%NStepWave2) !< Array of all non-negative angular frequencies (rad/s)
+ REAL(SiKi), INTENT(IN ) :: WaveS1SddArr(0:WaveField%NStepWave2) !< One-sided power spectral density of the wave spectrum at all non-negative frequencies (m^2/(rad/s))
+ REAL(SiKi), INTENT(IN ) :: CosWaveDir(0:WaveField%NStepWave2) !< COS( WaveDirArr(I) ) -- Each wave frequency has a unique wave direction
+ REAL(SiKi), INTENT(IN ) :: SinWaveDir(0:WaveField%NStepWave2) !< SIN( WaveDirArr(I) ) -- Each wave frequency has a unique wave direction
TYPE(FFT_DataType), INTENT(IN ) :: FFT_Data !< data for FFT computations, already initialized
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< error level/status
CHARACTER(ErrMsgLen), INTENT( OUT) :: ErrMsg !< error message
@@ -2392,8 +2397,8 @@ SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddA
INTEGER(IntKi) :: Iter !< Number of iterations when trying to meet the prescribed crest height (-)
INTEGER(IntKi) :: MaxCrestIter = 20 !< Maximum number of iterations when trying to meet the prescribed crest height (-)
- REAL(SiKi) :: tmpArr(0:InitOut%NStepWave2) !< A temporary array of real numbers of constrained wave (-)
- COMPLEX(SiKi) :: tmpComplexArr(0:InitOut%NStepWave2) !< A temporary array for FFT use
+ REAL(SiKi) :: tmpArr(0:WaveField%NStepWave2) !< A temporary array of real numbers of constrained wave (-)
+ COMPLEX(SiKi) :: tmpComplexArr(0:WaveField%NStepWave2) !< A temporary array for FFT use
COMPLEX(SiKi) :: tmpComplex ! A temporary varible to hold the complex value of the wave elevation before storing it into a REAL array
@@ -2409,16 +2414,16 @@ SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddA
! Modify the wave components to implement the constrained wave
! Compute the relevant sums
- m0 = InitOut%WaveDOmega * SUM(WaveS1SddArr)
- m2 = InitOut%WaveDOmega * SUM(WaveS1SddArr*OmegaArr*OmegaArr)
+ m0 = WaveField%WaveDOmega * SUM(WaveS1SddArr)
+ m2 = WaveField%WaveDOmega * SUM(WaveS1SddArr*OmegaArr*OmegaArr)
WaveElevC0ReSum = SUM(WaveField%WaveElevC0(1,:))/m0
WaveElevC0ImOmegaSum = SUM(WaveField%WaveElevC0(2,:) * OmegaArr)/m2
! Apply the part of the modification that is independent from the crest elevation
- WaveField%WaveElevC0(1,:) = WaveField%WaveElevC0(1,:) - WaveElevC0ReSum * WaveS1SddArr * InitOut%WaveDOmega
- WaveField%WaveElevC0(2,:) = WaveField%WaveElevC0(2,:) - WaveElevC0ImOmegaSum * OmegaArr * WaveS1SddArr * InitOut%WaveDOmega
+ WaveField%WaveElevC0(1,:) = WaveField%WaveElevC0(1,:) - WaveElevC0ReSum * WaveS1SddArr * WaveField%WaveDOmega
+ WaveField%WaveElevC0(2,:) = WaveField%WaveElevC0(2,:) - WaveElevC0ImOmegaSum * OmegaArr * WaveS1SddArr * WaveField%WaveDOmega
Crest = 0.5_SiKi * InitInp%CrestHmax ! Set crest elevation to half of crest height
- tmpArr = InitOut%NStepWave2/m0 * InitOut%WaveDOmega * WaveS1SddArr
+ tmpArr = WaveField%NStepWave2/m0 * WaveField%WaveDOmega * WaveS1SddArr
IF (InitInp%ConstWaveMod == 1) THEN ! Crest elevation prescribed
@@ -2437,13 +2442,13 @@ SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddA
! Compute the crest height based on the current guess of crest elevation
tmpComplexArr = CMPLX( WaveField%WaveElevC0(1,:) + Crest * tmpArr, &
WaveField%WaveElevC0(2,:))
- CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:InitOut%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
+ CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:WaveField%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while applying the FFT to WaveElev0.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) RETURN
! Find the preceding or following trough, whichever is lower
- Trough = MIN(MINVAL(WaveField%WaveElev0(1:MIN(NStepTp,InitOut%NStepWave-1))), &
- MINVAL(WaveField%WaveElev0(MAX(InitOut%NStepWave-NStepTp,0):InitOut%NStepWave-1)))
+ Trough = MIN(MINVAL(WaveField%WaveElev0(1:MIN(NStepTp,WaveField%NStepWave-1))), &
+ MINVAL(WaveField%WaveElev0(MAX(WaveField%NStepWave-NStepTp,0):WaveField%NStepWave-1)))
CrestHeight = Crest-Trough
CrestHeightError = ABS(CrestHeight - InitInp%CrestHmax)
! print *, CrestHeight
@@ -2452,14 +2457,14 @@ SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddA
! Compute the crest height based on a slightly nudged crest elevation
tmpComplexArr = CMPLX( WaveField%WaveElevC0(1,:) + (Crest+CrestHeightTol) * tmpArr, &
WaveField%WaveElevC0(2,:))
- CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:InitOut%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
+ CALL ApplyFFT_cx ( WaveField%WaveElev0 (0:WaveField%NStepWave-1), tmpComplexArr (: ), FFT_Data, ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while applying the FFT to WaveElev0.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) RETURN
! Find the preceding or following trough, whichever is lower
- Trough = MIN(MINVAL(WaveField%WaveElev0(1:MIN(NStepTp,InitOut%NStepWave-1))), &
- MINVAL(WaveField%WaveElev0(MAX(InitOut%NStepWave-NStepTp,0):InitOut%NStepWave-1)))
+ Trough = MIN(MINVAL(WaveField%WaveElev0(1:MIN(NStepTp,WaveField%NStepWave-1))), &
+ MINVAL(WaveField%WaveElev0(MAX(WaveField%NStepWave-NStepTp,0):WaveField%NStepWave-1)))
CrestHeight1 = Crest+CrestHeightTol-Trough
! Update crest elevation with Newton-Raphson Method
Crest = Crest - (CrestHeight-InitInp%CrestHmax)*CrestHeightTol/(CrestHeight1-CrestHeight)
@@ -2471,8 +2476,8 @@ SUBROUTINE ConstrainedNewWaves(InitInp, InitOut, WaveField, OmegaArr, WaveS1SddA
ENDIF
! Modify the wave phase so that the crest shows up at the right place and the right time
- DO I = 1,InitOut%NStepWave2-1
- WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, InitInp%WtrDpth )
+ DO I = 1,WaveField%NStepWave2-1
+ WaveNmbr = WaveNumber ( OmegaArr(I), InitInp%Gravity, WaveField%EffWtrDpth )
ConstWavePhase = WaveNmbr*(CosWaveDir(I)*InitInp%CrestXi + &
SinWaveDir(I)*InitInp%CrestYi) - &
OmegaArr(I)*InitInp%CrestTime
diff --git a/modules/seastate/src/Waves.txt b/modules/seastate/src/Waves.txt
index 4c8f94d42f..262c5dc74c 100644
--- a/modules/seastate/src/Waves.txt
+++ b/modules/seastate/src/Waves.txt
@@ -23,28 +23,16 @@ typedef ^ ^ CHARACTER(1024) DirRoot
typedef ^ ^ CHARACTER(1024) WvKinFile - - - "The root name of user input wave kinematics files" -
typedef ^ ^ ReKi Gravity - - - "Gravitational acceleration" (m/s^2)
typedef ^ ^ integer nGrid 3 - - "Grid dimensions"
-typedef ^ ^ SiKi WvLowCOff - - - "Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WvHiCOff - - - "High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4]" (rad/s)
-typedef ^ ^ SiKi WaveDir - - - "Mean incident wave propagation heading direction" (degrees)
typedef ^ ^ INTEGER WaveNDir - - - "Number of wave directions [only used if WaveDirMod = 1] [Must be an odd number -- will be adjusted within the waves module]" (-)
-typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
-typedef ^ ^ INTEGER WaveDirMod - - - "Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6]" -
typedef ^ ^ SiKi WaveDirSpread - - - "Spreading coefficient [WaveMod=2,3,4 and WaveDirMod=1]" -
typedef ^ ^ SiKi WaveDirRange - - - "Range of wave directions (full range: WaveDir +/- WaveDirRange/2) [only used if WaveMod=6]" (degrees)
typedef ^ ^ DbKi WaveDT - - - "Time step for incident wave calculations" (sec)
typedef ^ ^ SiKi WaveHs - - - "Significant wave height of incident waves" (meters)
-typedef ^ ^ INTEGER WaveMod - - - "Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED }" -
-typedef ^ ^ CHARACTER(80) WaveModChr - - - "String to temporarially hold the value of the wave kinematics input line"
typedef ^ ^ LOGICAL WaveNDAmp - - - "Flag for normally-distributed amplitudes in incident waves spectrum [flag]" -
typedef ^ ^ SiKi WavePhase - - - "Specified phase for regular waves" (radians)
typedef ^ ^ SiKi WavePkShp - - - "Peak shape parameter of incident wave spectrum [1.0 for Pierson-Moskowitz]" -
-typedef ^ ^ CHARACTER(80) WavePkShpChr - - - "String to temporarially hold value of peak shape parameter input line" -
-typedef ^ ^ INTEGER WaveSeed {2} - - "Random seeds of incident waves [-2147483648 to 2147483647]" -
-typedef ^ ^ INTEGER WaveStMod - - - "Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching}" -
typedef ^ ^ DbKi WaveTMax - - - "Analysis time for incident wave calculations; the actual analysis time may be larger than this value in order for the maintain an effecient FFT" (sec)
typedef ^ ^ SiKi WaveTp - - - "Peak spectral period of incident waves" (sec)
-typedef ^ ^ ReKi WtrDens - - - "Water density" (kg/m^3)
-typedef ^ ^ ReKi WtrDpth - - - "Water depth" (meters)
typedef ^ ^ INTEGER NWaveElevGrid - - - "Number of grid points where the incident wave elevations are computed (the XY grid point locations)" -
typedef ^ ^ INTEGER NWaveKinGrid - - - "Number of grid points where the incident wave kinematics will be computed" -
typedef ^ ^ SiKi WaveKinGridxi {:} - - "xi-coordinates for grid points where the incident wave kinematics will be computed (grid points); these are relative to the mean sea level" (meters)
@@ -54,39 +42,18 @@ typedef ^ ^ SiKi CurrVxi
typedef ^ ^ SiKi CurrVyi {:} - - "yi-component of the current velocity at elevation i" (m/s)
typedef ^ ^ SiKi PCurrVxiPz0 - - - "xi-component of the partial derivative of the current velocity at elevation near mean sea level" (m/s)
typedef ^ ^ SiKi PCurrVyiPz0 - - - "yi-component of the partial derivative of the current velocity at elevation near mean sea level" (m/s)
-typedef ^ ^ NWTC_RandomNumber_ParameterType RNG - - - "Parameters for the pseudo random number generator" -
+typedef ^ ^ NWTC_RandomNumber_ParameterType RNG - - - "Parameters for the pseudo random number generator" -
typedef ^ ^ INTEGER ConstWaveMod - - - "Mode of the constrained wave" -
typedef ^ ^ SiKi CrestHmax - - - "crest height or double the crest elevation" m
typedef ^ ^ SiKi CrestTime - - - "time of the wave crest" sec
typedef ^ ^ SiKi CrestXi - - - "xi-coordinate for the wave crest" m
typedef ^ ^ SiKi CrestYi - - - "yi-coordinate for the wave crest" m
-typedef ^ ^ SiKi MCFD - - - "Diameter of members that will use the MacCamy-Fuchs diffraction model"
typedef ^ ^ INTEGER WaveFieldMod - - - "Wave field handling (-) (switch) 0: use individual SeaState inputs without adjustment, 1: adjust wave phases based on turbine offsets from farm origin" -
typedef ^ ^ ReKi PtfmLocationX - - - "Supplied by Driver: X coordinate of platform location in the wave field" "m"
typedef ^ ^ ReKi PtfmLocationY - - - "Supplied by Driver: Y coordinate of platform location in the wave field" "m"
# Define outputs from the initialization routine here:
#
-typedef ^ InitOutputType 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 ^ InitOutputType SiKi WaveElevC {:}{:}{:} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part" (meters)
-typedef ^ ^ SiKi WaveDirArr {*} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
-typedef ^ ^ SiKi WaveDirMin - - - "Minimum wave direction." (degrees)
-typedef ^ ^ SiKi WaveDirMax - - - "Maximum wave direction." (degrees)
-typedef ^ ^ INTEGER WaveNDir - - - "Number of wave directions [only used if WaveDirMod = 1] [Must be an odd number -- will be adjusted within the waves module]" (-)
-typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
-typedef ^ ^ SiKi WaveDynP {*}{*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi WaveAcc {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi WaveAccMCF {*}{*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi WaveVel {*}{*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi PWaveDynP0 {*}{*}{*} - - "Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (N/m^2)
-typedef ^ ^ SiKi PWaveAcc0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi PWaveAccMCF0 {*}{*}{*}{*} - - "Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (m/s^2)
-typedef ^ ^ SiKi PWaveVel0 {*}{*}{*}{*} - - "Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ ^ SiKi WaveElev {*}{*}{*} - - "Instantaneous elevation time-series of incident waves at each of the XY grid points" (meters)
-typedef ^ ^ SiKi WaveElev0 {:} - - "Instantaneous elevation time-series of incident waves at the platform reference point" (meters)
-typedef ^ ^ SiKi WaveTime {*} - - "Simulation times at which the instantaneous elevation of, velocity of, acceleration of, and loads associated with the incident waves are determined" (sec)
-typedef ^ ^ DbKi WaveTMax - - - "Analysis time for incident wave calculations; the actual analysis time may be larger than this value in order for the maintain an effecient FFT" (sec)
-typedef ^ ^ SiKi RhoXg - - - "= WtrDens*Gravity" -
-typedef ^ ^ INTEGER NStepWave - - - "Total number of frequency components = total number of time steps in the incident wave" -
-typedef ^ ^ INTEGER NStepWave2 - - - "NStepWave / 2" -
+typedef ^ InitOutputType INTEGER WaveNDir - - - "Number of wave directions [only used if WaveDirMod = 1] [Must be an odd number -- will be adjusted within the waves module]" (-)
+typedef ^ InitOutputType DbKi WaveTMax - - - "Analysis time for incident wave calculations; the actual analysis time may be larger than this value in order for the maintain an effecient FFT" (sec)
diff --git a/modules/seastate/src/Waves2.f90 b/modules/seastate/src/Waves2.f90
index 9b84aa2138..f7edb77883 100644
--- a/modules/seastate/src/Waves2.f90
+++ b/modules/seastate/src/Waves2.f90
@@ -59,11 +59,10 @@ MODULE Waves2
!> @brief
!! This routine is called at the start of the simulation to perform initialization steps.
!! The parameters that are set here are not changed during the simulation.
-SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
+SUBROUTINE Waves2_Init( InitInp, InitOut, WaveField, ErrStat, ErrMsg )
!..................................................................................................................................
TYPE(Waves2_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine
- TYPE(Waves2_ParameterType), INTENT( OUT) :: p !< Parameters
TYPE(Waves2_InitOutputType), INTENT( OUT) :: InitOut !< Output for initialization routine
TYPE(SeaSt_WaveFieldType), INTENT(INOUT) :: WaveField !< WaveFieldType
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
@@ -197,48 +196,6 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
ErrMsgTmp = ""
- !-----------------------------------------------------------------------------
- !> Before attempting to do any real calculations, we first check what was
- !! passed in through _InitInp_ to make sure it makes sense. That routine will
- !! then copy over the relevant information that should be kept in parameters
- !! (_p_).
- !!
- !! _InitInp_ will also check the flags, existence of files, and set flags
- !! accordingly.
- !-----------------------------------------------------------------------------
-
-
- !--------------------------------------------------------------------------------
- ! Check the Min and Max frequencies for the full QTF cases
- ! -- these checks are performed based on the DiffQTFF and SumQTFF flags
- !--------------------------------------------------------------------------------
-
- ! 1. Check that the min / max diff frequencies make sense if using DiffQTF
-
- IF ( InitInp%WvDiffQTFF .eqv. .TRUE. ) THEN
- IF ( ( InitInp%WvHiCOffD < InitInp%WvLowCOffD ) .OR. ( InitInp%WvLowCOffD < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal, ' Programming Error in call to Waves2_Init: '//NewLine// &
- ' WvHiCOffD must be larger than WvLowCOffD. Both must be positive.'// &
- ' --> This should have been checked by the calling program.', ErrStat, ErrMsg, RoutineName)
- CALL CleanUp()
- RETURN
- END IF
- END IF
-
-
- ! 2. Check that the min / max diff frequencies make sense if using SumQTF
-
- IF ( InitInp%WvSumQTFF .eqv. .TRUE. ) THEN
- IF ( ( InitInp%WvHiCOffS < InitInp%WvLowCOffS ) .OR. ( InitInp%WvLowCOffS < 0.0 ) ) THEN
- CALL SetErrStat( ErrID_Fatal, ' Programming Error in call to Waves2_Init: '//NewLine// &
- ' WvHiCOffS must be larger than WvLowCOffS. Both must be positive.'// &
- ' --> This should have been checked by the calling program.', ErrStat, ErrMsg, RoutineName)
- CALL CleanUp
- RETURN
- END IF
- END IF
-
-
!--------------------------------------------------------------------------------
! Check the size of arrays that were passed in containing the wave info
@@ -247,9 +204,9 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Check that WaveElevC0 is a 2x(NStepWave2+1) sized array (0 index start)
- IF ( SIZE( WaveField%WaveElevC0, DIM=2 ) /= (InitInp%NStepWave2 + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
+ IF ( SIZE( WaveField%WaveElevC0, DIM=2 ) /= (WaveField%NStepWave2 + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
CALL SetErrStat( ErrID_Fatal, ' Programming error in call to Waves2_Init:'//NewLine// &
- ' --> Expected array for WaveElevC0 to be of size 2x'//TRIM(Num2LStr(InitInp%NStepWave2 + 1))// &
+ ' --> Expected array for WaveElevC0 to be of size 2x'//TRIM(Num2LStr(WaveField%NStepWave2 + 1))// &
' (2x(NStepWave2+1)), but instead received array of size '// &
TRIM(Num2LStr(SIZE(WaveField%WaveElevC0,1)))//'x'//TRIM(Num2LStr(SIZE(WaveField%WaveElevC0,2)))//'.', &
ErrStat, ErrMsg, RoutineName)
@@ -260,9 +217,9 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Check that WaveTime is of size (NStepWave+1)
- IF ( SIZE( WaveField%WaveTime ) /= (InitInp%NStepWave + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
+ IF ( SIZE( WaveField%WaveTime ) /= (WaveField%NStepWave + 1) ) THEN ! Expect a 2x(0:NStepWave2) array
CALL SetErrStat( ErrID_Fatal, ' Programming error in call to Waves2_Init:'//NewLine// &
- ' --> Expected array for WaveTime to be of size '//TRIM(Num2LStr(InitInp%NStepWave + 1))// &
+ ' --> Expected array for WaveTime to be of size '//TRIM(Num2LStr(WaveField%NStepWave + 1))// &
' (NStepWave+1), but instead received array of size '// &
TRIM(Num2LStr(SIZE(WaveField%WaveTime)))//'.', &
ErrStat, ErrMsg, RoutineName)
@@ -272,26 +229,19 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!--------------------------------------------------------------------------------
- ! Now copy over things to parameters...
+ !
!--------------------------------------------------------------------------------
- ! Difference QTF
- p%WvDiffQTFF = InitInp%WvDiffQTFF ! Flag for calculation
-
- ! Summation QTF
- p%WvSumQTFF = InitInp%WvSumQTFF ! Flag for calculation
-
-
! The wave elevation information in frequency space -- we need to normalize this by NStepWave2
- ALLOCATE ( WaveElevC0Norm(0:InitInp%NStepWave2) , STAT=ErrStatTmp )
+ ALLOCATE ( WaveElevC0Norm(0:WaveField%NStepWave2) , STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) then
CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveElevC0Norm.',ErrStat,ErrMsg,RoutineName)
CALL CleanUp()
RETURN
END IF
- DO I=0,InitInp%NStepWave2
- WaveElevC0Norm(I) = CMPLX( WaveField%WaveElevC0(1,I), WaveField%WaveElevC0(2,I), SiKi ) / REAL(InitInp%NStepWave2,SiKi)
+ DO I=0,WaveField%NStepWave2
+ WaveElevC0Norm(I) = CMPLX( WaveField%WaveElevC0(1,I), WaveField%WaveElevC0(2,I), SiKi ) / REAL(WaveField%NStepWave2,SiKi)
ENDDO
!--------------------------------------------------------------------------------
@@ -315,14 +265,14 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Since we have no stretching, NWaveKin0Prime and WaveKinzi0Prime(:) are
! equal to the number of, and the zi-coordinates for, the points in the
- ! WaveKinGridzi(:) array between, and including, -WtrDpth and 0.0.
+ ! WaveKinGridzi(:) array between, and including, -EffWtrDpth and 0.0.
! Determine NWaveKin0Prime here:
NWaveKin0Prime = 0
DO J = 1,InitInp%NWaveKinGrid ! Loop through all mesh points where the incident wave kinematics will be computed
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
- IF ( InitInp%WaveKinGridzi(J) >= -InitInp%WtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
+ IF ( InitInp%WaveKinGridzi(J) >= -WaveField%EffWtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
NWaveKin0Prime = NWaveKin0Prime + 1
END IF
END DO ! J - All Morison nodes where the incident wave kinematics will be computed
@@ -346,8 +296,8 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
I = 1
DO J = 1,InitInp%NWaveKinGrid ! Loop through all points where the incident wave kinematics will be computed without stretching
- ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and WtrDpth have already been adjusted using MSL2SWL
- IF ( InitInp%WaveKinGridzi(J) >= -InitInp%WtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
+ ! NOTE: We test to 0 instead of MSL2SWL because the locations of WaveKinGridzi and EffWtrDpth have already been adjusted using MSL2SWL
+ IF ( InitInp%WaveKinGridzi(J) >= -WaveField%EffWtrDpth .AND. InitInp%WaveKinGridzi(J) <= 0 ) THEN
WaveKinzi0Prime(I) = InitInp%WaveKinGridzi(J)
WaveKinPrimeMap(I) = J
@@ -384,25 +334,25 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!--------------------------------------------------------------------------------
! Setup the output arrays
!--------------------------------------------------------------------------------
- ALLOCATE ( WaveField%WaveElev2 (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ) , STAT=ErrStatTmp )
+ ALLOCATE ( WaveField%WaveElev2 (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2) ) , STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveField%WaveElev2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveVel2D (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveVel2D (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveVel2D.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveAcc2D (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveAcc2D (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveAcc2D.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveDynP2D (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveDynP2D (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveDynP2D.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveVel2S (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveVel2S (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveVel2S.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveAcc2S (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveAcc2S (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3),3), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveAcc2S.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( InitOut%WaveDynP2S (0:InitInp%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStatTmp )
+ ALLOCATE ( InitOut%WaveDynP2S (0:WaveField%NStepWave,InitInp%NGrid(1),InitInp%NGrid(2),InitInp%NGrid(3) ), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array InitOut%WaveDynP2S.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -411,10 +361,8 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
RETURN
END IF
- !InitOut%WaveElev2 => WaveField%WaveElev2
-
!Initialize the output arrays to zero. We will only fill it in for the points we calculate.
- WaveField%WaveElev2 = 0.0_SiKi
+ WaveField%WaveElev2 = 0.0_SiKi
InitOut%WaveVel2D = 0.0_SiKi
InitOut%WaveAcc2D = 0.0_SiKi
InitOut%WaveDynP2D = 0.0_SiKi
@@ -426,14 +374,14 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! For calculating the 2nd-order wave elevation corrections, we need a temporary array to hold the information.
- ALLOCATE ( TmpTimeSeries(0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( TmpTimeSeries(0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array TmpTimeSeries.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( TmpTimeSeries2(0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( TmpTimeSeries2(0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array TmpTimeSeries2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( TmpFreqSeries(0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( TmpFreqSeries(0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array TmpFreqSeries.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( TmpFreqSeries2(0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( TmpFreqSeries2(0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array TmpFreqSeries2.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -446,7 +394,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Setup the FFT working arrays
!--------------------------------------------------------------------------------
- CALL InitFFT ( InitInp%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
+ CALL InitFFT ( WaveField%NStepWave, FFT_Data, .FALSE., ErrStatTmp )
CALL SetErrStat(ErrStatTmp,'Error occured while initializing the FFT.',ErrStat,ErrMsg,RoutineName)
IF ( ErrStat >= AbortErrLev ) THEN
CALL CleanUp()
@@ -470,7 +418,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!--------------------------------------------------------------------------------
- IF(p%WvDiffQTFF) THEN
+ IF(InitInp%WvDiffQTFF) THEN
! Tell our nice users what is about to happen that may take a while:
CALL WrScr ( ' Calculating second order difference frequency wave kinematics.' )
@@ -482,21 +430,21 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Frequency space arrays:
- ALLOCATE ( WaveVel2xCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2yCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2yCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2yCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2yCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2yCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2yCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zCDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zCDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zCDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2CDiff (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2CDiff (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2CDiff.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -507,21 +455,21 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Time domain arrays:
- ALLOCATE ( WaveVel2xDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2yDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2yDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2yDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2yDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2yDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2yDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zDiff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zDiff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zDiff.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2Diff (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2Diff (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2Diff.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -578,22 +526,22 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! \f$ \mu^- \f$ loop. This loop is used to construct the full set of \f$ H_{\mu^-} \f$ terms used in the IFFT to find the timeseries.
!> * \f$ \mu^- = n -m \f$
- DO mu_minus=1,InitInp%NStepWave2-1
+ DO mu_minus=1,WaveField%NStepWave2-1
! The frequency we are dealing with
!> * \f$ \omega^- = \mu^- \Delta \omega \f$
- Omega_minus = mu_minus * InitInp%WaveDOmega
+ Omega_minus = mu_minus * WaveField%WaveDOmega
- IF ( Omega_minus >= InitInp%WvLowCOffD .AND. Omega_minus <= InitInp%WvHiCOffD ) THEN
+ IF ( Omega_minus >= WaveField%WvLowCOffD .AND. Omega_minus <= WaveField%WvHiCOffD ) THEN
! The inner \f$ m \f$ loop for calculating the \f$ H_{\mu^-} \f$ terms at each frequency.
- DO m=1,InitInp%NStepWave2-mu_minus
+ DO m=1,WaveField%NStepWave2-mu_minus
! Calculate the value of the n index from \f$ \mu^- = n - m \f$. Calculate corresponding wavenumbers and frequencies.
n = mu_minus + m
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
- k_m = WaveNumber( Omega_m, InitInp%Gravity, InitInp%WtrDpth )
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
+ k_m = WaveNumber( Omega_m, InitInp%Gravity, WaveField%EffWtrDpth )
k_nm = k_nm_minus( n, m, k_n, k_m )
@@ -617,7 +565,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Calculate \f$ U^- \f$ terms for the velocity calculations (\f$B^-\f$ provided by waves2::transfuncb_minus)
- ! NOTE: InitInp%WtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
+ ! NOTE: WaveField%EffWtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
!> * \f$ _x{U}_{nm}^- = B_{nm}^- \left(k_n \cos \theta_n - k_m \cos \theta_m \right) \f$
Ux_nm_minus = B_minus * ( k_n * COS( D2R_S*WaveField%WaveDirArr(n) ) - k_m * COS( D2R_S*WaveField%WaveDirArr(m) ) )
@@ -625,7 +573,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
Uy_nm_minus = B_minus * ( k_n * SIN( D2R_S*WaveField%WaveDirArr(n) ) - k_m * SIN( D2R_S*WaveField%WaveDirArr(m) ) )
!> * \f$ _z{U}_{nm}^- = \imath B_{nm}^- k_{nm} \tanh \left( k_{nm} ( h + z ) \right) \f$
- Uz_nm_minus = ImagNmbr * B_minus * k_nm * tanh( k_nm * ( InitInp%WtrDpth + WaveKinzi0Prime(I) ) )
+ Uz_nm_minus = ImagNmbr * B_minus * k_nm * tanh( k_nm * ( WaveField%EffWtrDpth + WaveKinzi0Prime(I) ) )
!> Acceleration calculations
@@ -636,7 +584,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Dynamic pressure
!> * \f$ P_{nm}^- = \rho_\mathrm{w} B_{nm}^- \omega_{\mu^-} \f$
- DynP_nm_minus = REAL(InitInp%WtrDens,SiKi) * B_minus * Omega_minus
+ DynP_nm_minus = REAL(WaveField%WtrDens,SiKi) * B_minus * Omega_minus
@@ -733,15 +681,15 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Copy the first point to the last to make it easier.
! TODO: Why don't these have the 2.0 multipler?? GJH 9/8/21
- InitOut%WaveVel2D(InitInp%NStepWave,ii,jj,kk,1) = WaveVel2xDiff(0)
- InitOut%WaveVel2D(InitInp%NStepWave,ii,jj,kk,2) = WaveVel2yDiff(0)
- InitOut%WaveVel2D(InitInp%NStepWave,ii,jj,kk,3) = WaveVel2zDiff(0)
+ InitOut%WaveVel2D(WaveField%NStepWave,ii,jj,kk,1) = WaveVel2xDiff(0)
+ InitOut%WaveVel2D(WaveField%NStepWave,ii,jj,kk,2) = WaveVel2yDiff(0)
+ InitOut%WaveVel2D(WaveField%NStepWave,ii,jj,kk,3) = WaveVel2zDiff(0)
- InitOut%WaveAcc2D(InitInp%NStepWave,ii,jj,kk,1) = WaveAcc2xDiff(0)
- InitOut%WaveAcc2D(InitInp%NStepWave,ii,jj,kk,2) = WaveAcc2yDiff(0)
- InitOut%WaveAcc2D(InitInp%NStepWave,ii,jj,kk,3) = WaveAcc2zDiff(0)
+ InitOut%WaveAcc2D(WaveField%NStepWave,ii,jj,kk,1) = WaveAcc2xDiff(0)
+ InitOut%WaveAcc2D(WaveField%NStepWave,ii,jj,kk,2) = WaveAcc2yDiff(0)
+ InitOut%WaveAcc2D(WaveField%NStepWave,ii,jj,kk,3) = WaveAcc2zDiff(0)
- InitOut%WaveDynP2D(InitInp%NStepWave,ii,jj,kk) = WaveDynP2Diff(0)
+ InitOut%WaveDynP2D(WaveField%NStepWave,ii,jj,kk) = WaveDynP2Diff(0)
ENDDO ! I=1,NWaveKin0Prime loop end
@@ -770,7 +718,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
END IF
- ENDIF ! p%WvDiffQTFF
+ ENDIF ! WvDiffQTFF
@@ -795,7 +743,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!--------------------------------------------------------------------------------
- IF(p%WvSumQTFF) THEN
+ IF(InitInp%WvSumQTFF) THEN
! Tell our nice users what is about to happen that may take a while:
CALL WrScr ( ' Calculating second order sum frequency wave kinematics.' )
@@ -807,39 +755,39 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Frequency space arrays: Term 1 (n=m term)
- ALLOCATE ( WaveVel2xCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2yCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2yCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2yCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2yCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2yCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2yCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zCSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zCSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zCSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2CSumT1 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2CSumT1 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2CSumT1.', ErrStat,ErrMsg,RoutineName)
! Term 2 (n/=m term)
- ALLOCATE ( WaveVel2xCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2yCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2yCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2yCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2yCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2yCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2yCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zCSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zCSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zCSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2CSumT2 (0:InitInp%NStepWave2), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2CSumT2 (0:WaveField%NStepWave2), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2CSumT2.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -851,39 +799,39 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Time domain arrays: Term 1 (n=m term)
- ALLOCATE ( WaveVel2xSumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xSumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2ySumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2ySumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2ySumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zSumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zSumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xSumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xSumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2ySumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2ySumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2ySumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zSumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zSumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zSumT1.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2SumT1 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2SumT1 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2SumT1.', ErrStat,ErrMsg,RoutineName)
! Term 2 (n/=m term)
- ALLOCATE ( WaveVel2xSumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2xSumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2xSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2ySumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2ySumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2ySumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveVel2zSumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveVel2zSumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveVel2zSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2xSumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2xSumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2xSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2ySumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2ySumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2ySumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveAcc2zSumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveAcc2zSumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveAcc2zSumT2.', ErrStat,ErrMsg,RoutineName)
- ALLOCATE ( WaveDynP2SumT2 (0:InitInp%NStepWave), STAT=ErrStatTmp )
+ ALLOCATE ( WaveDynP2SumT2 (0:WaveField%NStepWave), STAT=ErrStatTmp )
IF (ErrStatTmp /= 0) CALL SetErrStat(ErrID_Fatal,'Cannot allocate array WaveDynP2SumT2.', ErrStat,ErrMsg,RoutineName)
! Now check if all the allocations worked properly
@@ -958,17 +906,17 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! The limits look a little funny. But remember we are placing the value in the 2*J location,
! so we cannot overun the end of the array. The floor function is just in case NStepWave2 is
! an odd number
- DO n=1,FLOOR( REAL(InitInp%NStepWave2-1) / 2.0_SiKi ) ! Only
+ DO n=1,FLOOR( REAL(WaveField%NStepWave2-1) / 2.0_SiKi ) ! Only
- Omega_n = n * InitInp%WaveDOmega
+ Omega_n = n * WaveField%WaveDOmega
! The frequency we are dealing with
!> * \f$ \omega^+ = \mu^+ \Delta \omega = 2 \omega_n \f$
mu_plus = 2 * n
Omega_plus = 2.0_SiKi * Omega_n
- IF ( Omega_plus >= InitInp%WvLowCOffS .AND. Omega_plus <= InitInp%WvHiCOffS ) THEN
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
+ IF ( Omega_plus >= WaveField%WvLowCOffS .AND. Omega_plus <= WaveField%WvHiCOffS ) THEN
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
k_nm = k_nm_plus( n, n, k_n, k_n )
@@ -992,7 +940,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Calculate \f$ U^+ \f$ terms for the velocity calculations (\f$B^+\f$ provided by waves2::transfuncb_plus)
- ! NOTE: InitInp%WtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
+ ! NOTE: WaveField%EffWtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
!> * \f$ _x{U}_{nn}^+ = B_{nn}^+ 2 k_n \cos \theta_n \f$
Ux_nm_plus = B_plus * 2.0_SiKi * k_n * COS( D2R_S*WaveField%WaveDirArr(n) )
@@ -1000,7 +948,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
Uy_nm_plus = B_plus * 2.0_SiKi * k_n * SIN( D2R_S*WaveField%WaveDirArr(n) )
!> * \f$ _z{U}_{nn}^+ = \imath B_{nn}^+ k_{nn} \tanh \left( k_{nn} ( h + z ) \right) \f$
- Uz_nm_plus = ImagNmbr * B_plus * k_nm * tanh( k_nm * ( InitInp%WtrDpth + WaveKinzi0Prime(I) ) )
+ Uz_nm_plus = ImagNmbr * B_plus * k_nm * tanh( k_nm * ( WaveField%EffWtrDpth + WaveKinzi0Prime(I) ) )
!> Acceleration calculations
@@ -1011,7 +959,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Dynamic pressure
!> * \f$ P_{nn}^+ = \rho_\mathrm{w} B_{nn}^+ \omega_{\mu^+} \f$
- DynP_nm_plus = REAL(InitInp%WtrDens, SiKi) * B_plus * Omega_plus
+ DynP_nm_plus = REAL(WaveField%WtrDens, SiKi) * B_plus * Omega_plus
@@ -1056,21 +1004,21 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! \f$ \mu^+ \f$ loop. This loop is used to construct the full set of \f$ H_{\mu^+} \f$ terms used in the IFFT to find the timeseries.
!> * \f$ \mu^+ = n + m \f$
- DO mu_plus=2,InitInp%NStepWave2-1
+ DO mu_plus=2,WaveField%NStepWave2-1
! The frequency we are dealing with
!> * \f$ \omega^+ = \mu^+ \Delta \omega \f$
- Omega_plus = mu_plus * InitInp%WaveDOmega
+ Omega_plus = mu_plus * WaveField%WaveDOmega
- IF ( Omega_plus >= InitInp%WvLowCOffS .AND. Omega_plus <= InitInp%WvHiCOffS ) THEN
+ IF ( Omega_plus >= WaveField%WvLowCOffS .AND. Omega_plus <= WaveField%WvHiCOffS ) THEN
! The inner \f$ m \f$ loop for calculating the \f$ H_{\mu^+} \f$ terms at each frequency.
DO m=1,FLOOR( REAL(mu_plus - 1) / 2.0_SiKi )
! Calculate the value of the n index from \f$ \mu^+ = n + m \f$. Calculate corresponding wavenumbers and frequencies.
n = mu_plus - m
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
- k_m = WaveNumber( Omega_m, InitInp%Gravity, InitInp%WtrDpth )
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
+ k_m = WaveNumber( Omega_m, InitInp%Gravity, WaveField%EffWtrDpth )
k_nm = k_nm_plus( n, m, k_n, k_m )
@@ -1094,7 +1042,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Calculate \f$ U^+ \f$ terms for the velocity calculations (\f$B^+\f$ provided by waves2::transfuncb_plus)
- ! NOTE: InitInp%WtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
+ ! NOTE: WaveField%EffWtrDpth + WaveKinzi0Prime(I) is the height above the ocean floor
!> * \f$ _x{U}_{nm}^+ = B_{nm}^+ \left(k_n \cos \theta_n + k_m \cos \theta_m \right) \f$
Ux_nm_plus = B_plus * ( k_n * COS( D2R_S*WaveField%WaveDirArr(n) ) + k_m * COS( D2R_S*WaveField%WaveDirArr(m) ) )
@@ -1102,7 +1050,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
Uy_nm_plus = B_plus * ( k_n * SIN( D2R_S*WaveField%WaveDirArr(n) ) + k_m * SIN( D2R_S*WaveField%WaveDirArr(m) ) )
!> * \f$ _z{U}_{nm}^+ = \imath B_{nm}^+ k_{nm} \tanh \left( k_{nm} ( h + z ) \right) \f$
- Uz_nm_plus = ImagNmbr * B_plus * k_nm * tanh( k_nm * ( InitInp%WtrDpth + WaveKinzi0Prime(I) ) )
+ Uz_nm_plus = ImagNmbr * B_plus * k_nm * tanh( k_nm * ( WaveField%EffWtrDpth + WaveKinzi0Prime(I) ) )
!> Acceleration calculations
@@ -1113,7 +1061,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
!> Dynamic pressure
!> * \f$ P_{nm}^+ = \rho_\mathrm{w} B_{nm}^+ \omega_{\mu^+} \f$
- DynP_nm_plus = REAL(InitInp%WtrDens,SiKi) * B_plus * Omega_plus
+ DynP_nm_plus = REAL(WaveField%WtrDens,SiKi) * B_plus * Omega_plus
@@ -1232,9 +1180,9 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
! Copy the first point to the last to make it easier.
- InitOut%WaveVel2S(InitInp%NStepWave,ii,jj,kk,:) = InitOut%WaveVel2S(0,ii,jj,kk,:)
- InitOut%WaveAcc2S(InitInp%NStepWave,ii,jj,kk,:) = InitOut%WaveAcc2S(0,ii,jj,kk,:)
- InitOut%WaveDynP2S(InitInp%NStepWave,ii,jj,kk) = InitOut%WaveDynP2S(0,ii,jj,kk)
+ InitOut%WaveVel2S(WaveField%NStepWave,ii,jj,kk,:) = InitOut%WaveVel2S(0,ii,jj,kk,:)
+ InitOut%WaveAcc2S(WaveField%NStepWave,ii,jj,kk,:) = InitOut%WaveAcc2S(0,ii,jj,kk,:)
+ InitOut%WaveDynP2S(WaveField%NStepWave,ii,jj,kk) = InitOut%WaveDynP2S(0,ii,jj,kk)
ENDDO ! I=1,NWaveKin0Prime loop end
@@ -1280,7 +1228,7 @@ SUBROUTINE Waves2_Init( InitInp, p, InitOut, WaveField, ErrStat, ErrMsg )
- ENDIF ! p%WvSumQTFF
+ ENDIF ! WvSumQTFF
@@ -1326,7 +1274,7 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Diff(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrSta
REAL(SiKi), INTENT(IN ) :: Xcoord
REAL(SiKi), INTENT(IN ) :: Ycoord
- REAL(SiKi), INTENT( OUT) :: WaveElevSeriesAtXY(0:InitInp%NStepWave)
+ REAL(SiKi), INTENT( OUT) :: WaveElevSeriesAtXY(0:WaveField%NStepWave)
INTEGER(IntKi), INTENT( OUT) :: ErrStatLcl
INTEGER(IntKi) :: ErrStatLcl2
CHARACTER(*), INTENT( OUT) :: ErrMsgLcl
@@ -1354,24 +1302,24 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Diff(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrSta
! \f$ \mu^- \f$ loop. This loop is used to construct the full set of \f$ H_{\mu^-} \f$ terms used in the IFFT to find the timeseries.
!> * \f$ \mu^- = n -m \f$
- DO mu_minus=1,InitInp%NStepWave2-1
+ DO mu_minus=1,WaveField%NStepWave2-1
! The frequency we are dealing with
!> * \f$ \omega^- = \mu^- \Delta \omega \f$
- Omega_minus = mu_minus * InitInp%WaveDOmega
+ Omega_minus = mu_minus * WaveField%WaveDOmega
- IF ( Omega_minus >= InitInp%WvLowCOffD .AND. Omega_minus <= InitInp%WvHiCOffD ) THEN
+ IF ( Omega_minus >= WaveField%WvLowCOffD .AND. Omega_minus <= WaveField%WvHiCOffD ) THEN
! The inner \f$ m \f$ loop for calculating the \f$ H_{\mu^-} \f$ terms at each frequency.
- DO m=1,InitInp%NStepWave2-mu_minus
+ DO m=1,WaveField%NStepWave2-mu_minus
! Calculate the value of the n index from \f$ \mu^- = n - m \f$. Calculate corresponding wavenumbers and frequencies.
n = mu_minus + m
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
- k_m = WaveNumber( Omega_m, InitInp%Gravity, InitInp%WtrDpth )
- R_n = k_n * tanh( k_n * InitInp%WtrDpth )
- R_m = k_m * tanh( k_m * InitInp%WtrDpth )
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
+ k_m = WaveNumber( Omega_m, InitInp%Gravity, WaveField%EffWtrDpth )
+ R_n = k_n * tanh( k_n * WaveField%EffWtrDpth )
+ R_m = k_m * tanh( k_m * WaveField%EffWtrDpth )
D_minus = TransFuncD_minus(n,m,k_n,k_m,R_n,R_m)
!> Calculate the value of
@@ -1431,7 +1379,7 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Diff(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrSta
CALL SetErrStat(ErrStatLcl2,'Error occured while applying the FFT on WaveElevSeriesAtXY.',ErrStatLcl,ErrMsgLcl,'WaveElevSeriesAtXY_Diff')
! Append first datapoint as the last as aid for repeated wave data
- WaveElevSeriesAtXY(InitInp%NStepWave) = WaveElevSeriesAtXY(0)
+ WaveElevSeriesAtXY(WaveField%NStepWave) = WaveElevSeriesAtXY(0)
END SUBROUTINE WaveElevTimeSeriesAtXY_Diff
@@ -1453,7 +1401,7 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Sum(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrStat
REAL(SiKi), INTENT(IN ) :: Xcoord
REAL(SiKi), INTENT(IN ) :: Ycoord
- REAL(SiKi), INTENT( OUT) :: WaveElevSeriesAtXY(0:InitInp%NStepWave)
+ REAL(SiKi), INTENT( OUT) :: WaveElevSeriesAtXY(0:WaveField%NStepWave)
INTEGER(IntKi), INTENT( OUT) :: ErrStatLcl
INTEGER(IntKi) :: ErrStatLcl2
CHARACTER(*), INTENT( OUT) :: ErrMsgLcl
@@ -1485,18 +1433,18 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Sum(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrStat
!> ## First term ##
! First term results are stored in TmpFreqSeries.
- DO n=1,FLOOR( REAL(InitInp%NStepWave2-1) / 2.0_SiKi ) ! Only
+ DO n=1,FLOOR( REAL(WaveField%NStepWave2-1) / 2.0_SiKi ) ! Only
- Omega_n = n * InitInp%WaveDOmega
+ Omega_n = n * WaveField%WaveDOmega
! The frequency we are dealing with
!> * \f$ \omega^+ = \mu^+ \Delta \omega = 2 \omega_n \f$
mu_plus = 2 * n
Omega_plus = 2.0_SiKi * Omega_n
- IF ( Omega_plus >= InitInp%WvLowCOffS .AND. Omega_plus <= InitInp%WvHiCOffS ) THEN
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
- R_n = k_n * tanh( k_n * InitInp%WtrDpth )
+ IF ( Omega_plus >= WaveField%WvLowCOffS .AND. Omega_plus <= WaveField%WvHiCOffS ) THEN
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
+ R_n = k_n * tanh( k_n * WaveField%EffWtrDpth )
D_plus = TransFuncD_plus(n,n,k_n,k_n,R_n,R_n)
!> Calculate the value of
@@ -1547,24 +1495,24 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Sum(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrStat
! \f$ \mu^+ \f$ loop. This loop is used to construct the full set of \f$ H_{\mu^+} \f$ terms used in the IFFT to find the timeseries.
!> * \f$ \mu^+ = n + m \f$
- DO mu_plus=2,InitInp%NStepWave2-1
+ DO mu_plus=2,WaveField%NStepWave2-1
! The frequency we are dealing with
!> * \f$ \omega^+ = \mu^+ \Delta \omega \f$
- Omega_plus = mu_plus * InitInp%WaveDOmega
+ Omega_plus = mu_plus * WaveField%WaveDOmega
- IF ( Omega_plus >= InitInp%WvLowCOffS .AND. Omega_plus <= InitInp%WvHiCOffS ) THEN
+ IF ( Omega_plus >= WaveField%WvLowCOffS .AND. Omega_plus <= WaveField%WvHiCOffS ) THEN
! The inner \f$ m \f$ loop for calculating the \f$ H_{\mu^+} \f$ terms at each frequency.
DO m=1,FLOOR( REAL(mu_plus - 1) / 2.0_SiKi )
! Calculate the value of the n index from \f$ \mu^+ = n + m \f$. Calculate corresponding wavenumbers and frequencies.
n = mu_plus - m
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
- k_n = WaveNumber( Omega_n, InitInp%Gravity, InitInp%WtrDpth )
- k_m = WaveNumber( Omega_m, InitInp%Gravity, InitInp%WtrDpth )
- R_n = k_n * tanh( k_n * InitInp%WtrDpth )
- R_m = k_m * tanh( k_m * InitInp%WtrDpth )
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
+ k_n = WaveNumber( Omega_n, InitInp%Gravity, WaveField%EffWtrDpth )
+ k_m = WaveNumber( Omega_m, InitInp%Gravity, WaveField%EffWtrDpth )
+ R_n = k_n * tanh( k_n * WaveField%EffWtrDpth )
+ R_m = k_m * tanh( k_m * WaveField%EffWtrDpth )
D_plus = TransFuncD_plus(n,m,k_n,k_m,R_n,R_m)
!> Calculate the value of
@@ -1620,12 +1568,12 @@ SUBROUTINE WaveElevTimeSeriesAtXY_Sum(Xcoord,Ycoord, WaveElevSeriesAtXY, ErrStat
CALL SetErrStat(ErrStatLcl2,'Error occured while applying the FFT on WaveElevSeriesAtXY.',ErrStatLcl,ErrMsgLcl,'WaveElevSeriesAtXY_Sum')
! Add the two terms together
- DO Ctr=0,InitInp%NStepWave
+ DO Ctr=0,WaveField%NStepWave
WaveElevSeriesAtXY(Ctr) = WaveElevSeriesAtXY(Ctr) + 2.0_SiKi * TmpTimeSeries2(Ctr)
ENDDO
! Append first datapoint as the last as aid for repeated wave data
- WaveElevSeriesAtXY(InitInp%NStepWave) = WaveElevSeriesAtXY(0)
+ WaveElevSeriesAtXY(WaveField%NStepWave) = WaveElevSeriesAtXY(0)
END SUBROUTINE WaveElevTimeSeriesAtXY_Sum
@@ -1673,15 +1621,15 @@ FUNCTION TransFuncB_minus(n,m,k_n,k_m,z)
ELSE
! Frequencies
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
! Wavenumbers
k_nm = k_nm_minus( n,m,k_n,k_m )
! Effect of depth scaling
- R_n = k_n * tanh( k_n * InitInp%WtrDpth )
- R_m = k_m * tanh( k_m * InitInp%WtrDpth )
+ R_n = k_n * tanh( k_n * WaveField%EffWtrDpth )
+ R_m = k_m * tanh( k_m * WaveField%EffWtrDpth )
! Transfer function D_minus
D_minus = TransFuncD_minus(n,m,k_n,k_m,R_n,R_m)
@@ -1689,7 +1637,7 @@ FUNCTION TransFuncB_minus(n,m,k_n,k_m,z)
! Calculation of B_minus
TransFuncB_minus = REAL(InitInp%Gravity*InitInp%Gravity,SiKi) / ( 4.0_SiKi * Omega_n * Omega_m ) &
- * COSHNumOvrCOSHDen(k_nm, REAL(InitInp%WtrDpth,SiKi), z) * D_minus / ( Omega_n - Omega_m )
+ * COSHNumOvrCOSHDen(k_nm, REAL(WaveField%EffWtrDpth,SiKi), z) * D_minus / ( Omega_n - Omega_m )
ENDIF
@@ -1735,22 +1683,22 @@ FUNCTION TransFuncB_plus(n,m,k_n,k_m,z)
ELSE
! Frequencies
- Omega_n = n * InitInp%WaveDOmega
- Omega_m = m * InitInp%WaveDOmega
+ Omega_n = n * WaveField%WaveDOmega
+ Omega_m = m * WaveField%WaveDOmega
! Wavenumbers
k_nm = k_nm_plus( n,m,k_n,k_m )
! Effect of depth scaling
- R_n = k_n * tanh( k_n * InitInp%WtrDpth )
- R_m = k_m * tanh( k_m * InitInp%WtrDpth )
+ R_n = k_n * tanh( k_n * WaveField%EffWtrDpth )
+ R_m = k_m * tanh( k_m * WaveField%EffWtrDpth )
! Transfer function D_plus
D_plus = TransFuncD_plus(n,m,k_n,k_m,R_n,R_m)
! Calculation of B_plus
TransFuncB_plus = REAL(InitInp%Gravity*InitInp%Gravity,SiKi) / ( 4.0_SiKi * Omega_n * Omega_m ) &
- * COSHNumOvrCOSHDen(k_nm, REAL(InitInp%WtrDpth,SiKi), z) * D_plus / ( Omega_n + Omega_m )
+ * COSHNumOvrCOSHDen(k_nm, REAL(WaveField%EffWtrDpth,SiKi), z) * D_plus / ( Omega_n + Omega_m )
ENDIF
@@ -1868,7 +1816,7 @@ FUNCTION TransFuncD_minus(n,m,k_n,k_m,R_n,R_m)
Num2 = 2*SqrtRnMinusRm*SqrtRnMinusRm*( k_n * k_m * COS( D2R_S*WaveField%WaveDirArr(n) - D2R_S*WaveField%WaveDirArr(m) ) + R_n*R_m )
! Calculate the denominator
- Den = SqrtRnMinusRm*SqrtRnMinusRm - k_nm * tanh( k_nm * InitInp%WtrDpth )
+ Den = SqrtRnMinusRm*SqrtRnMinusRm - k_nm * tanh( k_nm * WaveField%EffWtrDpth )
TransFuncD_minus = (Num1+Num2) / Den
@@ -1932,7 +1880,7 @@ FUNCTION TransFuncD_plus(n,m,k_n,k_m,R_n,R_m)
Num2 = 2*SqrtRnPlusRm*SqrtRnPlusRm*( k_n * k_m * COS( D2R_S*WaveField%WaveDirArr(n) - D2R_S*WaveField%WaveDirArr(m) ) - R_n*R_m )
! Calculate the denominator
- Den = SqrtRnPlusRm*SqrtRnPlusRm - k_nm * tanh( k_nm * InitInp%WtrDpth )
+ Den = SqrtRnPlusRm*SqrtRnPlusRm - k_nm * tanh( k_nm * WaveField%EffWtrDpth )
TransFuncD_plus = (Num1+Num2) / Den
diff --git a/modules/seastate/src/Waves2.txt b/modules/seastate/src/Waves2.txt
index 74899068d3..0437fbe7f2 100644
--- a/modules/seastate/src/Waves2.txt
+++ b/modules/seastate/src/Waves2.txt
@@ -19,20 +19,6 @@ include Registry_NWTC_Library.txt
# e.g., the name of the input file, the file root name,etc.
#
typedef Waves2/Waves2 InitInputType ReKi Gravity - - - "Gravitational acceleration" (m/s^2)
-typedef ^ ^ ReKi WtrDens - - - "Water density" (kg/m^3)
-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" -
-typedef ^ ^ SiKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
-
-typedef ^ ^ INTEGER WaveStMod - - - "Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching}" -
-
-typedef ^ ^ LOGICAL WaveMultiDir - - - "Indicates the waves are multidirectional -- set by HydroDyn_Input" -
-typedef ^ ^ SiKi WaveDirArr {*} - - "Wave direction array. Each frequency has a unique direction of WaveNDir > 1" (degrees)
-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 WaveTime {*} - - "Simulation times at which the instantaneous second order loads associated with the incident waves are determined" sec
-
typedef ^ ^ integer nGrid 3 - - "Grid dimensions"
typedef ^ ^ INTEGER NWaveElevGrid - - - "Number of grid points where the incident wave elevations can be output" -
typedef ^ ^ INTEGER NWaveKinGrid - - - "Number of grid points where the incident wave kinematics will be computed" -
@@ -43,11 +29,6 @@ typedef ^ ^ SiKi WaveKinGrid
typedef ^ ^ LOGICAL WvDiffQTFF - - - "Full difference QTF second order forces flag" (-)
typedef ^ ^ LOGICAL WvSumQTFF - - - "Full sum QTF second order forces flag" (-)
-typedef ^ ^ SiKi WvLowCOffD - - - "Minimum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffD - - - "Maximum frequency used in the difference methods [Ignored if all difference methods = 0]" (rad/s)
-typedef ^ ^ SiKi WvLowCOffS - - - "Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-typedef ^ ^ SiKi WvHiCOffS - - - "Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0]" (rad/s)
-
# Define outputs from the initialization routine here:
#
@@ -57,13 +38,5 @@ typedef ^ ^ SiKi WaveAcc2S
typedef ^ ^ SiKi WaveDynP2S {:}{:}{:}{:} - - "Instantaneous 2nd-order sum frequency correction for the dynamic pressure of incident waves , at each of the NWaveKinGrid points where the incident wave kinematics will be computed" (N/m^2)
typedef ^ ^ SiKi WaveVel2D {:}{:}{:}{:}{:} - - "Instantaneous 2nd-order difference frequency correction for the velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
typedef ^ ^ SiKi WaveVel2S {:}{:}{:}{:}{:} - - "Instantaneous 2nd-order sum frequency correction for the velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.)" (m/s)
-typedef ^ InitOutputType SiKi WaveElev2 {*}{*}{*} - - "Instantaneous elevation time-series of incident waves at each of the NWaveElevGrid points where the incident wave elevations can be output" (meters)
-
-
-# ..... Parameters ................................................................................................................
-# Define parameters here:
-# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states:
-typedef ^ ParameterType LOGICAL WvDiffQTFF - - - "Full difference QTF second order forces flag" (-)
-typedef ^ ParameterType LOGICAL WvSumQTFF - - - "Full sum QTF second order forces flag" (-)
diff --git a/modules/seastate/src/Waves2_Types.f90 b/modules/seastate/src/Waves2_Types.f90
index 2bdcf55998..ee5d2ba6c1 100644
--- a/modules/seastate/src/Waves2_Types.f90
+++ b/modules/seastate/src/Waves2_Types.f90
@@ -36,16 +36,6 @@ MODULE Waves2_Types
! ========= Waves2_InitInputType =======
TYPE, PUBLIC :: Waves2_InitInputType
REAL(ReKi) :: Gravity = 0.0_ReKi !< Gravitational acceleration [(m/s^2)]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density [(kg/m^3)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [(meters)]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Total number of frequency components = total number of time steps in the incident wave [-]
- INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< NStepWave / 2 [-]
- REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} [-]
- LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Wave direction array. Each frequency has a unique direction of WaveNDir > 1 [(degrees)]
- 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) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Simulation times at which the instantaneous second order loads associated with the incident waves are determined [sec]
INTEGER(IntKi) , DIMENSION(1:3) :: nGrid = 0_IntKi !< Grid dimensions [-]
INTEGER(IntKi) :: NWaveElevGrid = 0_IntKi !< Number of grid points where the incident wave elevations can be output [-]
INTEGER(IntKi) :: NWaveKinGrid = 0_IntKi !< Number of grid points where the incident wave kinematics will be computed [-]
@@ -54,10 +44,6 @@ MODULE Waves2_Types
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinGridzi !< zi-coordinates for grid points where the incident wave kinematics will be computed; these are relative to the mean sea level [(meters)]
LOGICAL :: WvDiffQTFF = .false. !< Full difference QTF second order forces flag [(-)]
LOGICAL :: WvSumQTFF = .false. !< Full sum QTF second order forces flag [(-)]
- REAL(SiKi) :: WvLowCOffD = 0.0_R4Ki !< Minimum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffD = 0.0_R4Ki !< Maximum frequency used in the difference methods [Ignored if all difference methods = 0] [(rad/s)]
- REAL(SiKi) :: WvLowCOffS = 0.0_R4Ki !< Minimum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
- REAL(SiKi) :: WvHiCOffS = 0.0_R4Ki !< Maximum frequency used in the sum-QTF method [Ignored if SumQTF = 0] [(rad/s)]
END TYPE Waves2_InitInputType
! =======================
! ========= Waves2_InitOutputType =======
@@ -68,15 +54,8 @@ MODULE Waves2_Types
REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: WaveDynP2S !< Instantaneous 2nd-order sum frequency correction for the dynamic pressure of incident waves , at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(N/m^2)]
REAL(SiKi) , DIMENSION(:,:,:,:,:), ALLOCATABLE :: WaveVel2D !< Instantaneous 2nd-order difference frequency correction for the velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
REAL(SiKi) , DIMENSION(:,:,:,:,:), ALLOCATABLE :: WaveVel2S !< Instantaneous 2nd-order sum frequency correction for the velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev2 => NULL() !< Instantaneous elevation time-series of incident waves at each of the NWaveElevGrid points where the incident wave elevations can be output [(meters)]
END TYPE Waves2_InitOutputType
! =======================
-! ========= Waves2_ParameterType =======
- TYPE, PUBLIC :: Waves2_ParameterType
- LOGICAL :: WvDiffQTFF = .false. !< Full difference QTF second order forces flag [(-)]
- LOGICAL :: WvSumQTFF = .false. !< Full sum QTF second order forces flag [(-)]
- END TYPE Waves2_ParameterType
-! =======================
CONTAINS
subroutine Waves2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg)
@@ -85,22 +64,12 @@ subroutine Waves2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(2), UB(2)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: ErrStat2
character(*), parameter :: RoutineName = 'Waves2_CopyInitInput'
ErrStat = ErrID_None
ErrMsg = ''
DstInitInputData%Gravity = SrcInitInputData%Gravity
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
- DstInitInputData%NStepWave = SrcInitInputData%NStepWave
- DstInitInputData%NStepWave2 = SrcInitInputData%NStepWave2
- DstInitInputData%WaveDOmega = SrcInitInputData%WaveDOmega
- DstInitInputData%WaveStMod = SrcInitInputData%WaveStMod
- DstInitInputData%WaveMultiDir = SrcInitInputData%WaveMultiDir
- DstInitInputData%WaveDirArr => SrcInitInputData%WaveDirArr
- DstInitInputData%WaveElevC0 => SrcInitInputData%WaveElevC0
- DstInitInputData%WaveTime => SrcInitInputData%WaveTime
DstInitInputData%nGrid = SrcInitInputData%nGrid
DstInitInputData%NWaveElevGrid = SrcInitInputData%NWaveElevGrid
DstInitInputData%NWaveKinGrid = SrcInitInputData%NWaveKinGrid
@@ -142,10 +111,6 @@ subroutine Waves2_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Er
end if
DstInitInputData%WvDiffQTFF = SrcInitInputData%WvDiffQTFF
DstInitInputData%WvSumQTFF = SrcInitInputData%WvSumQTFF
- DstInitInputData%WvLowCOffD = SrcInitInputData%WvLowCOffD
- DstInitInputData%WvHiCOffD = SrcInitInputData%WvHiCOffD
- DstInitInputData%WvLowCOffS = SrcInitInputData%WvLowCOffS
- DstInitInputData%WvHiCOffS = SrcInitInputData%WvHiCOffS
end subroutine
subroutine Waves2_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
@@ -155,9 +120,6 @@ subroutine Waves2_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
character(*), parameter :: RoutineName = 'Waves2_DestroyInitInput'
ErrStat = ErrID_None
ErrMsg = ''
- nullify(InitInputData%WaveDirArr)
- nullify(InitInputData%WaveElevC0)
- nullify(InitInputData%WaveTime)
if (allocated(InitInputData%WaveKinGridxi)) then
deallocate(InitInputData%WaveKinGridxi)
end if
@@ -173,40 +135,8 @@ subroutine Waves2_PackInitInput(Buf, Indata)
type(PackBuffer), intent(inout) :: Buf
type(Waves2_InitInputType), intent(in) :: InData
character(*), parameter :: RoutineName = 'Waves2_PackInitInput'
- logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, InData%Gravity)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, InData%WaveStMod)
- call RegPack(Buf, InData%WaveMultiDir)
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
call RegPack(Buf, InData%nGrid)
call RegPack(Buf, InData%NWaveElevGrid)
call RegPack(Buf, InData%NWaveKinGrid)
@@ -227,10 +157,6 @@ subroutine Waves2_PackInitInput(Buf, Indata)
end if
call RegPack(Buf, InData%WvDiffQTFF)
call RegPack(Buf, InData%WvSumQTFF)
- call RegPack(Buf, InData%WvLowCOffD)
- call RegPack(Buf, InData%WvHiCOffD)
- call RegPack(Buf, InData%WvLowCOffS)
- call RegPack(Buf, InData%WvHiCOffS)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -238,100 +164,12 @@ subroutine Waves2_UnPackInitInput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(Waves2_InitInputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'Waves2_UnPackInitInput'
- integer(IntKi) :: LB(2), UB(2)
+ integer(IntKi) :: LB(1), UB(1)
integer(IntKi) :: stat
logical :: IsAllocAssoc
- integer(IntKi) :: PtrIdx
- type(c_ptr) :: Ptr
if (Buf%ErrStat /= ErrID_None) return
call RegUnpack(Buf, OutData%Gravity)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMultiDir)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
- else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDirArr => null()
- end if
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
- else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC0 => null()
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
call RegUnpack(Buf, OutData%nGrid)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NWaveElevGrid)
@@ -384,14 +222,6 @@ subroutine Waves2_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WvSumQTFF)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffD)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOffS)
- if (RegCheckErr(Buf, RoutineName)) return
end subroutine
subroutine Waves2_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg)
@@ -477,7 +307,6 @@ subroutine Waves2_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode,
end if
DstInitOutputData%WaveVel2S = SrcInitOutputData%WaveVel2S
end if
- DstInitOutputData%WaveElev2 => SrcInitOutputData%WaveElev2
end subroutine
subroutine Waves2_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
@@ -505,14 +334,12 @@ subroutine Waves2_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
if (allocated(InitOutputData%WaveVel2S)) then
deallocate(InitOutputData%WaveVel2S)
end if
- nullify(InitOutputData%WaveElev2)
end subroutine
subroutine Waves2_PackInitOutput(Buf, Indata)
type(PackBuffer), intent(inout) :: Buf
type(Waves2_InitOutputType), intent(in) :: InData
character(*), parameter :: RoutineName = 'Waves2_PackInitOutput'
- logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, allocated(InData%WaveAcc2D))
if (allocated(InData%WaveAcc2D)) then
@@ -544,14 +371,6 @@ subroutine Waves2_PackInitOutput(Buf, Indata)
call RegPackBounds(Buf, 5, lbound(InData%WaveVel2S), ubound(InData%WaveVel2S))
call RegPack(Buf, InData%WaveVel2S)
end if
- call RegPack(Buf, associated(InData%WaveElev2))
- if (associated(InData%WaveElev2)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev2), ubound(InData%WaveElev2))
- call RegPackPointer(Buf, c_loc(InData%WaveElev2), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev2)
- end if
- end if
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -562,8 +381,6 @@ subroutine Waves2_UnPackInitOutput(Buf, OutData)
integer(IntKi) :: LB(5), UB(5)
integer(IntKi) :: stat
logical :: IsAllocAssoc
- integer(IntKi) :: PtrIdx
- type(c_ptr) :: Ptr
if (Buf%ErrStat /= ErrID_None) return
if (allocated(OutData%WaveAcc2D)) deallocate(OutData%WaveAcc2D)
call RegUnpack(Buf, IsAllocAssoc)
@@ -649,73 +466,6 @@ subroutine Waves2_UnPackInitOutput(Buf, OutData)
call RegUnpack(Buf, OutData%WaveVel2S)
if (RegCheckErr(Buf, RoutineName)) return
end if
- if (associated(OutData%WaveElev2)) deallocate(OutData%WaveElev2)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev2, UB(1:3)-LB(1:3))
- OutData%WaveElev2(LB(1):,LB(2):,LB(3):) => OutData%WaveElev2
- else
- allocate(OutData%WaveElev2(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev2.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev2)
- call RegUnpack(Buf, OutData%WaveElev2)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev2 => null()
- end if
-end subroutine
-
-subroutine Waves2_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
- type(Waves2_ParameterType), intent(in) :: SrcParamData
- type(Waves2_ParameterType), intent(inout) :: DstParamData
- integer(IntKi), intent(in ) :: CtrlCode
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'Waves2_CopyParam'
- ErrStat = ErrID_None
- ErrMsg = ''
- DstParamData%WvDiffQTFF = SrcParamData%WvDiffQTFF
- DstParamData%WvSumQTFF = SrcParamData%WvSumQTFF
-end subroutine
-
-subroutine Waves2_DestroyParam(ParamData, ErrStat, ErrMsg)
- type(Waves2_ParameterType), intent(inout) :: ParamData
- integer(IntKi), intent( out) :: ErrStat
- character(*), intent( out) :: ErrMsg
- character(*), parameter :: RoutineName = 'Waves2_DestroyParam'
- ErrStat = ErrID_None
- ErrMsg = ''
-end subroutine
-
-subroutine Waves2_PackParam(Buf, Indata)
- type(PackBuffer), intent(inout) :: Buf
- type(Waves2_ParameterType), intent(in) :: InData
- character(*), parameter :: RoutineName = 'Waves2_PackParam'
- if (Buf%ErrStat >= AbortErrLev) return
- call RegPack(Buf, InData%WvDiffQTFF)
- call RegPack(Buf, InData%WvSumQTFF)
- if (RegCheckErr(Buf, RoutineName)) return
-end subroutine
-
-subroutine Waves2_UnPackParam(Buf, OutData)
- type(PackBuffer), intent(inout) :: Buf
- type(Waves2_ParameterType), intent(inout) :: OutData
- character(*), parameter :: RoutineName = 'Waves2_UnPackParam'
- if (Buf%ErrStat /= ErrID_None) return
- call RegUnpack(Buf, OutData%WvDiffQTFF)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvSumQTFF)
- if (RegCheckErr(Buf, RoutineName)) return
end subroutine
END MODULE Waves2_Types
!ENDOFREGISTRYGENERATEDFILE
diff --git a/modules/seastate/src/Waves_Types.f90 b/modules/seastate/src/Waves_Types.f90
index ba7d81ef96..00cfd710db 100644
--- a/modules/seastate/src/Waves_Types.f90
+++ b/modules/seastate/src/Waves_Types.f90
@@ -40,28 +40,16 @@ MODULE Waves_Types
CHARACTER(1024) :: WvKinFile !< The root name of user input wave kinematics files [-]
REAL(ReKi) :: Gravity = 0.0_ReKi !< Gravitational acceleration [(m/s^2)]
INTEGER(IntKi) , DIMENSION(1:3) :: nGrid = 0_IntKi !< Grid dimensions [-]
- REAL(SiKi) :: WvLowCOff = 0.0_R4Ki !< Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WvHiCOff = 0.0_R4Ki !< High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed. [used only when WaveMod=2,3,4] [(rad/s)]
- REAL(SiKi) :: WaveDir = 0.0_R4Ki !< Mean incident wave propagation heading direction [(degrees)]
INTEGER(IntKi) :: WaveNDir = 0_IntKi !< Number of wave directions [only used if WaveDirMod = 1] [Must be an odd number -- will be adjusted within the waves module] [(-)]
- LOGICAL :: WaveMultiDir = .false. !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
- INTEGER(IntKi) :: WaveDirMod = 0_IntKi !< Directional wave spreading function {0: none, 1: COS2S} [only used if WaveMod=6] [-]
REAL(SiKi) :: WaveDirSpread = 0.0_R4Ki !< Spreading coefficient [WaveMod=2,3,4 and WaveDirMod=1] [-]
REAL(SiKi) :: WaveDirRange = 0.0_R4Ki !< Range of wave directions (full range: WaveDir +/- WaveDirRange/2) [only used if WaveMod=6] [(degrees)]
REAL(DbKi) :: WaveDT = 0.0_R8Ki !< Time step for incident wave calculations [(sec)]
REAL(SiKi) :: WaveHs = 0.0_R4Ki !< Significant wave height of incident waves [(meters)]
- INTEGER(IntKi) :: WaveMod = 0_IntKi !< Incident wave kinematics model {0: none=still water, 1: plane progressive (regular), 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: white-noise spectrum, 4: user-defind spectrum from routine UserWaveSpctrm (irregular), 5: GH BLADED } [-]
- CHARACTER(80) :: WaveModChr !< String to temporarially hold the value of the wave kinematics input line [-]
LOGICAL :: WaveNDAmp = .false. !< Flag for normally-distributed amplitudes in incident waves spectrum [flag] [-]
REAL(SiKi) :: WavePhase = 0.0_R4Ki !< Specified phase for regular waves [(radians)]
REAL(SiKi) :: WavePkShp = 0.0_R4Ki !< Peak shape parameter of incident wave spectrum [1.0 for Pierson-Moskowitz] [-]
- CHARACTER(80) :: WavePkShpChr !< String to temporarially hold value of peak shape parameter input line [-]
- INTEGER(IntKi) , DIMENSION(1:2) :: WaveSeed = 0_IntKi !< Random seeds of incident waves [-2147483648 to 2147483647] [-]
- INTEGER(IntKi) :: WaveStMod = 0_IntKi !< Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} [-]
REAL(DbKi) :: WaveTMax = 0.0_R8Ki !< Analysis time for incident wave calculations; the actual analysis time may be larger than this value in order for the maintain an effecient FFT [(sec)]
REAL(SiKi) :: WaveTp = 0.0_R4Ki !< Peak spectral period of incident waves [(sec)]
- REAL(ReKi) :: WtrDens = 0.0_ReKi !< Water density [(kg/m^3)]
- REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [(meters)]
INTEGER(IntKi) :: NWaveElevGrid = 0_IntKi !< Number of grid points where the incident wave elevations are computed (the XY grid point locations) [-]
INTEGER(IntKi) :: NWaveKinGrid = 0_IntKi !< Number of grid points where the incident wave kinematics will be computed [-]
REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveKinGridxi !< xi-coordinates for grid points where the incident wave kinematics will be computed (grid points); these are relative to the mean sea level [(meters)]
@@ -77,7 +65,6 @@ MODULE Waves_Types
REAL(SiKi) :: CrestTime = 0.0_R4Ki !< time of the wave crest [sec]
REAL(SiKi) :: CrestXi = 0.0_R4Ki !< xi-coordinate for the wave crest [m]
REAL(SiKi) :: CrestYi = 0.0_R4Ki !< yi-coordinate for the wave crest [m]
- REAL(SiKi) :: MCFD = 0.0_R4Ki !< Diameter of members that will use the MacCamy-Fuchs diffraction model [-]
INTEGER(IntKi) :: WaveFieldMod = 0_IntKi !< Wave field handling (-) (switch) 0: use individual SeaState inputs without adjustment, 1: adjust wave phases based on turbine offsets from farm origin [-]
REAL(ReKi) :: PtfmLocationX = 0.0_ReKi !< Supplied by Driver: X coordinate of platform location in the wave field [m]
REAL(ReKi) :: PtfmLocationY = 0.0_ReKi !< Supplied by Driver: Y coordinate of platform location in the wave field [m]
@@ -85,28 +72,8 @@ MODULE Waves_Types
! =======================
! ========= Waves_InitOutputType =======
TYPE, PUBLIC :: Waves_InitOutputType
- 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) , DIMENSION(:,:,:), ALLOCATABLE :: WaveElevC !< Discrete Fourier transform of the instantaneous elevation of incident waves at all grid points. First column is real part, second column is imaginary part [(meters)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveDirArr => NULL() !< Wave direction array. Each frequency has a unique direction of WaveNDir > 1 [(degrees)]
- REAL(SiKi) :: WaveDirMin = 0.0_R4Ki !< Minimum wave direction. [(degrees)]
- REAL(SiKi) :: WaveDirMax = 0.0_R4Ki !< Maximum wave direction. [(degrees)]
INTEGER(IntKi) :: WaveNDir = 0_IntKi !< Number of wave directions [only used if WaveDirMod = 1] [Must be an odd number -- will be adjusted within the waves module] [(-)]
- REAL(SiKi) :: WaveDOmega = 0.0_R4Ki !< Frequency step for incident wave calculations [(rad/s)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: WaveDynP => NULL() !< Instantaneous dynamic pressure of incident waves , accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAcc => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveAccMCF => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:,:), POINTER :: WaveVel => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, accounting for stretching, at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: PWaveDynP0 => NULL() !< Instantaneous dynamic pressure of incident waves , at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(N/m^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveAcc0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveAccMCF0 => NULL() !< Instantaneous acceleration of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed [(m/s^2)]
- REAL(SiKi) , DIMENSION(:,:,:,:), POINTER :: PWaveVel0 => NULL() !< Instantaneous velocity of incident waves in the xi- (1), yi- (2), and zi- (3) directions, respectively, at the location (xi,yi,0), at each of the NWaveKinGrid points where the incident wave kinematics will be computed (The values include both the velocity of incident waves and the velocity of current.) [(m/s)]
- REAL(SiKi) , DIMENSION(:,:,:), POINTER :: WaveElev => NULL() !< Instantaneous elevation time-series of incident waves at each of the XY grid points [(meters)]
- REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: WaveElev0 !< Instantaneous elevation time-series of incident waves at the platform reference point [(meters)]
- REAL(SiKi) , DIMENSION(:), POINTER :: WaveTime => NULL() !< Simulation times at which the instantaneous elevation of, velocity of, acceleration of, and loads associated with the incident waves are determined [(sec)]
REAL(DbKi) :: WaveTMax = 0.0_R8Ki !< Analysis time for incident wave calculations; the actual analysis time may be larger than this value in order for the maintain an effecient FFT [(sec)]
- REAL(SiKi) :: RhoXg = 0.0_R4Ki !< = WtrDens*Gravity [-]
- INTEGER(IntKi) :: NStepWave = 0_IntKi !< Total number of frequency components = total number of time steps in the incident wave [-]
- INTEGER(IntKi) :: NStepWave2 = 0_IntKi !< NStepWave / 2 [-]
END TYPE Waves_InitOutputType
! =======================
CONTAINS
@@ -128,28 +95,16 @@ subroutine Waves_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Err
DstInitInputData%WvKinFile = SrcInitInputData%WvKinFile
DstInitInputData%Gravity = SrcInitInputData%Gravity
DstInitInputData%nGrid = SrcInitInputData%nGrid
- DstInitInputData%WvLowCOff = SrcInitInputData%WvLowCOff
- DstInitInputData%WvHiCOff = SrcInitInputData%WvHiCOff
- DstInitInputData%WaveDir = SrcInitInputData%WaveDir
DstInitInputData%WaveNDir = SrcInitInputData%WaveNDir
- DstInitInputData%WaveMultiDir = SrcInitInputData%WaveMultiDir
- DstInitInputData%WaveDirMod = SrcInitInputData%WaveDirMod
DstInitInputData%WaveDirSpread = SrcInitInputData%WaveDirSpread
DstInitInputData%WaveDirRange = SrcInitInputData%WaveDirRange
DstInitInputData%WaveDT = SrcInitInputData%WaveDT
DstInitInputData%WaveHs = SrcInitInputData%WaveHs
- DstInitInputData%WaveMod = SrcInitInputData%WaveMod
- DstInitInputData%WaveModChr = SrcInitInputData%WaveModChr
DstInitInputData%WaveNDAmp = SrcInitInputData%WaveNDAmp
DstInitInputData%WavePhase = SrcInitInputData%WavePhase
DstInitInputData%WavePkShp = SrcInitInputData%WavePkShp
- DstInitInputData%WavePkShpChr = SrcInitInputData%WavePkShpChr
- DstInitInputData%WaveSeed = SrcInitInputData%WaveSeed
- DstInitInputData%WaveStMod = SrcInitInputData%WaveStMod
DstInitInputData%WaveTMax = SrcInitInputData%WaveTMax
DstInitInputData%WaveTp = SrcInitInputData%WaveTp
- DstInitInputData%WtrDens = SrcInitInputData%WtrDens
- DstInitInputData%WtrDpth = SrcInitInputData%WtrDpth
DstInitInputData%NWaveElevGrid = SrcInitInputData%NWaveElevGrid
DstInitInputData%NWaveKinGrid = SrcInitInputData%NWaveKinGrid
if (allocated(SrcInitInputData%WaveKinGridxi)) then
@@ -222,7 +177,6 @@ subroutine Waves_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, Err
DstInitInputData%CrestTime = SrcInitInputData%CrestTime
DstInitInputData%CrestXi = SrcInitInputData%CrestXi
DstInitInputData%CrestYi = SrcInitInputData%CrestYi
- DstInitInputData%MCFD = SrcInitInputData%MCFD
DstInitInputData%WaveFieldMod = SrcInitInputData%WaveFieldMod
DstInitInputData%PtfmLocationX = SrcInitInputData%PtfmLocationX
DstInitInputData%PtfmLocationY = SrcInitInputData%PtfmLocationY
@@ -266,28 +220,16 @@ subroutine Waves_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%WvKinFile)
call RegPack(Buf, InData%Gravity)
call RegPack(Buf, InData%nGrid)
- call RegPack(Buf, InData%WvLowCOff)
- call RegPack(Buf, InData%WvHiCOff)
- call RegPack(Buf, InData%WaveDir)
call RegPack(Buf, InData%WaveNDir)
- call RegPack(Buf, InData%WaveMultiDir)
- call RegPack(Buf, InData%WaveDirMod)
call RegPack(Buf, InData%WaveDirSpread)
call RegPack(Buf, InData%WaveDirRange)
call RegPack(Buf, InData%WaveDT)
call RegPack(Buf, InData%WaveHs)
- call RegPack(Buf, InData%WaveMod)
- call RegPack(Buf, InData%WaveModChr)
call RegPack(Buf, InData%WaveNDAmp)
call RegPack(Buf, InData%WavePhase)
call RegPack(Buf, InData%WavePkShp)
- call RegPack(Buf, InData%WavePkShpChr)
- call RegPack(Buf, InData%WaveSeed)
- call RegPack(Buf, InData%WaveStMod)
call RegPack(Buf, InData%WaveTMax)
call RegPack(Buf, InData%WaveTp)
- call RegPack(Buf, InData%WtrDens)
- call RegPack(Buf, InData%WtrDpth)
call RegPack(Buf, InData%NWaveElevGrid)
call RegPack(Buf, InData%NWaveKinGrid)
call RegPack(Buf, allocated(InData%WaveKinGridxi))
@@ -323,7 +265,6 @@ subroutine Waves_PackInitInput(Buf, Indata)
call RegPack(Buf, InData%CrestTime)
call RegPack(Buf, InData%CrestXi)
call RegPack(Buf, InData%CrestYi)
- call RegPack(Buf, InData%MCFD)
call RegPack(Buf, InData%WaveFieldMod)
call RegPack(Buf, InData%PtfmLocationX)
call RegPack(Buf, InData%PtfmLocationY)
@@ -348,18 +289,8 @@ subroutine Waves_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%nGrid)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvLowCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WvHiCOff)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDir)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveNDir)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMultiDir)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMod)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveDirSpread)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveDirRange)
@@ -368,30 +299,16 @@ subroutine Waves_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveHs)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveMod)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveModChr)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveNDAmp)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WavePhase)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WavePkShp)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WavePkShpChr)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveSeed)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveStMod)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveTMax)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveTp)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDens)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WtrDpth)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NWaveElevGrid)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%NWaveKinGrid)
@@ -481,8 +398,6 @@ subroutine Waves_UnPackInitInput(Buf, OutData)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%CrestYi)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%MCFD)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveFieldMod)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%PtfmLocationX)
@@ -497,55 +412,11 @@ subroutine Waves_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode,
integer(IntKi), intent(in ) :: CtrlCode
integer(IntKi), intent( out) :: ErrStat
character(*), intent( out) :: ErrMsg
- integer(IntKi) :: LB(5), UB(5)
- integer(IntKi) :: ErrStat2
character(*), parameter :: RoutineName = 'Waves_CopyInitOutput'
ErrStat = ErrID_None
ErrMsg = ''
- DstInitOutputData%WaveElevC0 => SrcInitOutputData%WaveElevC0
- if (allocated(SrcInitOutputData%WaveElevC)) then
- LB(1:3) = lbound(SrcInitOutputData%WaveElevC)
- UB(1:3) = ubound(SrcInitOutputData%WaveElevC)
- if (.not. allocated(DstInitOutputData%WaveElevC)) then
- allocate(DstInitOutputData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)), stat=ErrStat2)
- if (ErrStat2 /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WaveElevC.', ErrStat, ErrMsg, RoutineName)
- return
- end if
- end if
- DstInitOutputData%WaveElevC = SrcInitOutputData%WaveElevC
- end if
- DstInitOutputData%WaveDirArr => SrcInitOutputData%WaveDirArr
- DstInitOutputData%WaveDirMin = SrcInitOutputData%WaveDirMin
- DstInitOutputData%WaveDirMax = SrcInitOutputData%WaveDirMax
DstInitOutputData%WaveNDir = SrcInitOutputData%WaveNDir
- DstInitOutputData%WaveDOmega = SrcInitOutputData%WaveDOmega
- DstInitOutputData%WaveDynP => SrcInitOutputData%WaveDynP
- DstInitOutputData%WaveAcc => SrcInitOutputData%WaveAcc
- DstInitOutputData%WaveAccMCF => SrcInitOutputData%WaveAccMCF
- DstInitOutputData%WaveVel => SrcInitOutputData%WaveVel
- DstInitOutputData%PWaveDynP0 => SrcInitOutputData%PWaveDynP0
- DstInitOutputData%PWaveAcc0 => SrcInitOutputData%PWaveAcc0
- DstInitOutputData%PWaveAccMCF0 => SrcInitOutputData%PWaveAccMCF0
- DstInitOutputData%PWaveVel0 => SrcInitOutputData%PWaveVel0
- DstInitOutputData%WaveElev => SrcInitOutputData%WaveElev
- if (allocated(SrcInitOutputData%WaveElev0)) then
- LB(1:1) = lbound(SrcInitOutputData%WaveElev0)
- UB(1:1) = ubound(SrcInitOutputData%WaveElev0)
- if (.not. allocated(DstInitOutputData%WaveElev0)) then
- allocate(DstInitOutputData%WaveElev0(LB(1):UB(1)), stat=ErrStat2)
- if (ErrStat2 /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WaveElev0.', ErrStat, ErrMsg, RoutineName)
- return
- end if
- end if
- DstInitOutputData%WaveElev0 = SrcInitOutputData%WaveElev0
- end if
- DstInitOutputData%WaveTime => SrcInitOutputData%WaveTime
DstInitOutputData%WaveTMax = SrcInitOutputData%WaveTMax
- DstInitOutputData%RhoXg = SrcInitOutputData%RhoXg
- DstInitOutputData%NStepWave = SrcInitOutputData%NStepWave
- DstInitOutputData%NStepWave2 = SrcInitOutputData%NStepWave2
end subroutine
subroutine Waves_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
@@ -555,146 +426,15 @@ subroutine Waves_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
character(*), parameter :: RoutineName = 'Waves_DestroyInitOutput'
ErrStat = ErrID_None
ErrMsg = ''
- nullify(InitOutputData%WaveElevC0)
- if (allocated(InitOutputData%WaveElevC)) then
- deallocate(InitOutputData%WaveElevC)
- end if
- nullify(InitOutputData%WaveDirArr)
- nullify(InitOutputData%WaveDynP)
- nullify(InitOutputData%WaveAcc)
- nullify(InitOutputData%WaveAccMCF)
- nullify(InitOutputData%WaveVel)
- nullify(InitOutputData%PWaveDynP0)
- nullify(InitOutputData%PWaveAcc0)
- nullify(InitOutputData%PWaveAccMCF0)
- nullify(InitOutputData%PWaveVel0)
- nullify(InitOutputData%WaveElev)
- if (allocated(InitOutputData%WaveElev0)) then
- deallocate(InitOutputData%WaveElev0)
- end if
- nullify(InitOutputData%WaveTime)
end subroutine
subroutine Waves_PackInitOutput(Buf, Indata)
type(PackBuffer), intent(inout) :: Buf
type(Waves_InitOutputType), intent(in) :: InData
character(*), parameter :: RoutineName = 'Waves_PackInitOutput'
- logical :: PtrInIndex
if (Buf%ErrStat >= AbortErrLev) return
- call RegPack(Buf, associated(InData%WaveElevC0))
- if (associated(InData%WaveElevC0)) then
- call RegPackBounds(Buf, 2, lbound(InData%WaveElevC0), ubound(InData%WaveElevC0))
- call RegPackPointer(Buf, c_loc(InData%WaveElevC0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElevC0)
- end if
- end if
- call RegPack(Buf, allocated(InData%WaveElevC))
- if (allocated(InData%WaveElevC)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElevC), ubound(InData%WaveElevC))
- call RegPack(Buf, InData%WaveElevC)
- end if
- call RegPack(Buf, associated(InData%WaveDirArr))
- if (associated(InData%WaveDirArr)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveDirArr), ubound(InData%WaveDirArr))
- call RegPackPointer(Buf, c_loc(InData%WaveDirArr), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDirArr)
- end if
- end if
- call RegPack(Buf, InData%WaveDirMin)
- call RegPack(Buf, InData%WaveDirMax)
call RegPack(Buf, InData%WaveNDir)
- call RegPack(Buf, InData%WaveDOmega)
- call RegPack(Buf, associated(InData%WaveDynP))
- if (associated(InData%WaveDynP)) then
- call RegPackBounds(Buf, 4, lbound(InData%WaveDynP), ubound(InData%WaveDynP))
- call RegPackPointer(Buf, c_loc(InData%WaveDynP), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveDynP)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAcc))
- if (associated(InData%WaveAcc)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAcc), ubound(InData%WaveAcc))
- call RegPackPointer(Buf, c_loc(InData%WaveAcc), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAcc)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveAccMCF))
- if (associated(InData%WaveAccMCF)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveAccMCF), ubound(InData%WaveAccMCF))
- call RegPackPointer(Buf, c_loc(InData%WaveAccMCF), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveAccMCF)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveVel))
- if (associated(InData%WaveVel)) then
- call RegPackBounds(Buf, 5, lbound(InData%WaveVel), ubound(InData%WaveVel))
- call RegPackPointer(Buf, c_loc(InData%WaveVel), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveVel)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveDynP0))
- if (associated(InData%PWaveDynP0)) then
- call RegPackBounds(Buf, 3, lbound(InData%PWaveDynP0), ubound(InData%PWaveDynP0))
- call RegPackPointer(Buf, c_loc(InData%PWaveDynP0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveDynP0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAcc0))
- if (associated(InData%PWaveAcc0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAcc0), ubound(InData%PWaveAcc0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAcc0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAcc0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveAccMCF0))
- if (associated(InData%PWaveAccMCF0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveAccMCF0), ubound(InData%PWaveAccMCF0))
- call RegPackPointer(Buf, c_loc(InData%PWaveAccMCF0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveAccMCF0)
- end if
- end if
- call RegPack(Buf, associated(InData%PWaveVel0))
- if (associated(InData%PWaveVel0)) then
- call RegPackBounds(Buf, 4, lbound(InData%PWaveVel0), ubound(InData%PWaveVel0))
- call RegPackPointer(Buf, c_loc(InData%PWaveVel0), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%PWaveVel0)
- end if
- end if
- call RegPack(Buf, associated(InData%WaveElev))
- if (associated(InData%WaveElev)) then
- call RegPackBounds(Buf, 3, lbound(InData%WaveElev), ubound(InData%WaveElev))
- call RegPackPointer(Buf, c_loc(InData%WaveElev), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveElev)
- end if
- end if
- call RegPack(Buf, allocated(InData%WaveElev0))
- if (allocated(InData%WaveElev0)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveElev0), ubound(InData%WaveElev0))
- call RegPack(Buf, InData%WaveElev0)
- end if
- call RegPack(Buf, associated(InData%WaveTime))
- if (associated(InData%WaveTime)) then
- call RegPackBounds(Buf, 1, lbound(InData%WaveTime), ubound(InData%WaveTime))
- call RegPackPointer(Buf, c_loc(InData%WaveTime), PtrInIndex)
- if (.not. PtrInIndex) then
- call RegPack(Buf, InData%WaveTime)
- end if
- end if
call RegPack(Buf, InData%WaveTMax)
- call RegPack(Buf, InData%RhoXg)
- call RegPack(Buf, InData%NStepWave)
- call RegPack(Buf, InData%NStepWave2)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine
@@ -702,344 +442,11 @@ subroutine Waves_UnPackInitOutput(Buf, OutData)
type(PackBuffer), intent(inout) :: Buf
type(Waves_InitOutputType), intent(inout) :: OutData
character(*), parameter :: RoutineName = 'Waves_UnPackInitOutput'
- integer(IntKi) :: LB(5), UB(5)
- integer(IntKi) :: stat
- logical :: IsAllocAssoc
- integer(IntKi) :: PtrIdx
- type(c_ptr) :: Ptr
if (Buf%ErrStat /= ErrID_None) return
- if (associated(OutData%WaveElevC0)) deallocate(OutData%WaveElevC0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 2, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElevC0, UB(1:2)-LB(1:2))
- OutData%WaveElevC0(LB(1):,LB(2):) => OutData%WaveElevC0
- else
- allocate(OutData%WaveElevC0(LB(1):UB(1),LB(2):UB(2)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElevC0)
- call RegUnpack(Buf, OutData%WaveElevC0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElevC0 => null()
- end if
- if (allocated(OutData%WaveElevC)) deallocate(OutData%WaveElevC)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- allocate(OutData%WaveElevC(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElevC.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- call RegUnpack(Buf, OutData%WaveElevC)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- if (associated(OutData%WaveDirArr)) deallocate(OutData%WaveDirArr)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDirArr, UB(1:1)-LB(1:1))
- OutData%WaveDirArr(LB(1):) => OutData%WaveDirArr
- else
- allocate(OutData%WaveDirArr(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDirArr.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDirArr)
- call RegUnpack(Buf, OutData%WaveDirArr)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDirArr => null()
- end if
- call RegUnpack(Buf, OutData%WaveDirMin)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDirMax)
- if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%WaveNDir)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%WaveDOmega)
- if (RegCheckErr(Buf, RoutineName)) return
- if (associated(OutData%WaveDynP)) deallocate(OutData%WaveDynP)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveDynP, UB(1:4)-LB(1:4))
- OutData%WaveDynP(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%WaveDynP
- else
- allocate(OutData%WaveDynP(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveDynP.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveDynP)
- call RegUnpack(Buf, OutData%WaveDynP)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveDynP => null()
- end if
- if (associated(OutData%WaveAcc)) deallocate(OutData%WaveAcc)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAcc, UB(1:5)-LB(1:5))
- OutData%WaveAcc(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAcc
- else
- allocate(OutData%WaveAcc(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAcc.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAcc)
- call RegUnpack(Buf, OutData%WaveAcc)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAcc => null()
- end if
- if (associated(OutData%WaveAccMCF)) deallocate(OutData%WaveAccMCF)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveAccMCF, UB(1:5)-LB(1:5))
- OutData%WaveAccMCF(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveAccMCF
- else
- allocate(OutData%WaveAccMCF(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveAccMCF.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveAccMCF)
- call RegUnpack(Buf, OutData%WaveAccMCF)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveAccMCF => null()
- end if
- if (associated(OutData%WaveVel)) deallocate(OutData%WaveVel)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 5, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveVel, UB(1:5)-LB(1:5))
- OutData%WaveVel(LB(1):,LB(2):,LB(3):,LB(4):,LB(5):) => OutData%WaveVel
- else
- allocate(OutData%WaveVel(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4),LB(5):UB(5)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveVel.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveVel)
- call RegUnpack(Buf, OutData%WaveVel)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveVel => null()
- end if
- if (associated(OutData%PWaveDynP0)) deallocate(OutData%PWaveDynP0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveDynP0, UB(1:3)-LB(1:3))
- OutData%PWaveDynP0(LB(1):,LB(2):,LB(3):) => OutData%PWaveDynP0
- else
- allocate(OutData%PWaveDynP0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveDynP0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveDynP0)
- call RegUnpack(Buf, OutData%PWaveDynP0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveDynP0 => null()
- end if
- if (associated(OutData%PWaveAcc0)) deallocate(OutData%PWaveAcc0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAcc0, UB(1:4)-LB(1:4))
- OutData%PWaveAcc0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAcc0
- else
- allocate(OutData%PWaveAcc0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAcc0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAcc0)
- call RegUnpack(Buf, OutData%PWaveAcc0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAcc0 => null()
- end if
- if (associated(OutData%PWaveAccMCF0)) deallocate(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveAccMCF0, UB(1:4)-LB(1:4))
- OutData%PWaveAccMCF0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveAccMCF0
- else
- allocate(OutData%PWaveAccMCF0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveAccMCF0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveAccMCF0)
- call RegUnpack(Buf, OutData%PWaveAccMCF0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveAccMCF0 => null()
- end if
- if (associated(OutData%PWaveVel0)) deallocate(OutData%PWaveVel0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 4, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%PWaveVel0, UB(1:4)-LB(1:4))
- OutData%PWaveVel0(LB(1):,LB(2):,LB(3):,LB(4):) => OutData%PWaveVel0
- else
- allocate(OutData%PWaveVel0(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3),LB(4):UB(4)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%PWaveVel0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%PWaveVel0)
- call RegUnpack(Buf, OutData%PWaveVel0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%PWaveVel0 => null()
- end if
- if (associated(OutData%WaveElev)) deallocate(OutData%WaveElev)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 3, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveElev, UB(1:3)-LB(1:3))
- OutData%WaveElev(LB(1):,LB(2):,LB(3):) => OutData%WaveElev
- else
- allocate(OutData%WaveElev(LB(1):UB(1),LB(2):UB(2),LB(3):UB(3)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveElev)
- call RegUnpack(Buf, OutData%WaveElev)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveElev => null()
- end if
- if (allocated(OutData%WaveElev0)) deallocate(OutData%WaveElev0)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- allocate(OutData%WaveElev0(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveElev0.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- call RegUnpack(Buf, OutData%WaveElev0)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- if (associated(OutData%WaveTime)) deallocate(OutData%WaveTime)
- call RegUnpack(Buf, IsAllocAssoc)
- if (RegCheckErr(Buf, RoutineName)) return
- if (IsAllocAssoc) then
- call RegUnpackBounds(Buf, 1, LB, UB)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpackPointer(Buf, Ptr, PtrIdx)
- if (RegCheckErr(Buf, RoutineName)) return
- if (c_associated(Ptr)) then
- call c_f_pointer(Ptr, OutData%WaveTime, UB(1:1)-LB(1:1))
- OutData%WaveTime(LB(1):) => OutData%WaveTime
- else
- allocate(OutData%WaveTime(LB(1):UB(1)),stat=stat)
- if (stat /= 0) then
- call SetErrStat(ErrID_Fatal, 'Error allocating OutData%WaveTime.', Buf%ErrStat, Buf%ErrMsg, RoutineName)
- return
- end if
- Buf%Pointers(PtrIdx) = c_loc(OutData%WaveTime)
- call RegUnpack(Buf, OutData%WaveTime)
- if (RegCheckErr(Buf, RoutineName)) return
- end if
- else
- OutData%WaveTime => null()
- end if
call RegUnpack(Buf, OutData%WaveTMax)
if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%RhoXg)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave)
- if (RegCheckErr(Buf, RoutineName)) return
- call RegUnpack(Buf, OutData%NStepWave2)
- if (RegCheckErr(Buf, RoutineName)) return
end subroutine
END MODULE Waves_Types
!ENDOFREGISTRYGENERATEDFILE
diff --git a/vs-build/HydroDyn_c_binding/HydroDyn_c_binding.vfproj b/vs-build/HydroDyn_c_binding/HydroDyn_c_binding.vfproj
index e7464b083b..7bcec48d49 100644
--- a/vs-build/HydroDyn_c_binding/HydroDyn_c_binding.vfproj
+++ b/vs-build/HydroDyn_c_binding/HydroDyn_c_binding.vfproj
@@ -208,42 +208,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vs-build/SeaState/SeaStateDriver.vfproj b/vs-build/SeaState/SeaStateDriver.vfproj
index 0de503b1af..c9a4786e34 100644
--- a/vs-build/SeaState/SeaStateDriver.vfproj
+++ b/vs-build/SeaState/SeaStateDriver.vfproj
@@ -5,7 +5,7 @@
-
+