Skip to content

Commit 7664528

Browse files
committed
SeaSt c-bind: replace numTimeSteps with time_max
- reorder arguments into Init
1 parent 0f4a7ee commit 7664528

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

glue-codes/labview/src/WaveTank.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ subroutine WaveTank_Init( &
222222
call SeaSt_C_Init( &
223223
SS_InputFile_C, &
224224
OutRootName_C, &
225-
1000_c_int, & !FIXME: do we need the number of timesteps???
225+
SimSettings%Sim%TMax, &
226226
SimSettings%Sim%DT, &
227227
SimSettings%ModSettings%WaveTimeShift, &
228228
SS_NumChannels_C, &

glue-codes/labview/src/WaveTank_IO.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ subroutine ParseInputFile(FileInfo_In, SimSettings, ErrStat, ErrMsg)
9999
! Separator/header lines skipped automatically
100100
! ----- Simulation control -------------
101101
call ParseVar( FileInfo_In, CurLine, 'DT', SimSettings%Sim%DT, ErrStat2, ErrMsg2); if(Failed()) return; ! timestep (unused)
102-
call ParseVar( FileInfo_In, CurLine, 'TMax', SimSettings%Sim%TMax, ErrStat2, ErrMsg2); if(Failed()) return; ! Max sim time (unused)
102+
call ParseVar( FileInfo_In, CurLine, 'TMax', SimSettings%Sim%TMax, ErrStat2, ErrMsg2); if(Failed()) return; ! Max sim time (used only with SeaState wavemod 5)
103103
call ParseVar( FileInfo_In, CurLine, 'MHK', SimSettings%Sim%MHK, ErrStat2, ErrMsg2); if(Failed()) return; ! MHK turbine type (switch) {0=Not an MHK turbine; 1=Fixed MHK turbine; 2=Floating MHK turbine}
104104
call ParseVar( FileInfo_In, CurLine, 'InterpOrd', SimSettings%Sim%InterpOrd, ErrStat2, ErrMsg2); if(Failed()) return; ! Interpolation order [unused]
105105
!TODO: These are placeholders for later use. Some of the logic is incomplete which is why this has been commented out.

glue-codes/python/pyOpenFAST/seastate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def _initialize_routines(self):
119119
self.SeaSt_C_Init.argtypes = [
120120
POINTER(c_char), # intent(in ) :: InputFile_c(IntfStrLen)
121121
POINTER(c_char), # intent(in ) :: OutRootName_c(IntfStrLen)
122-
POINTER(c_int), # intent(in ) :: NSteps_c
123122
POINTER(c_double), # intent(in ) :: TimeInterval_c
123+
POINTER(c_double), # intent(in ) :: TMax_c
124124
POINTER(c_double), # intent(in ) :: WaveTimeShift (positive only)
125125
POINTER(c_int), # intent( out) :: NumChannels_c
126126
POINTER(c_char), # intent( out) :: OutputChannelNames_C
@@ -261,7 +261,7 @@ def seastate_init(
261261
self,
262262
primary_ss_file,
263263
outrootname: str = "./seastate.SeaSt",
264-
n_steps: int = 801,
264+
time_max: float = 60,
265265
time_interval: float = 0.125,
266266
):
267267

@@ -283,8 +283,8 @@ def seastate_init(
283283
self.SeaSt_C_Init(
284284
ss_file_c,
285285
outrootname_c,
286-
byref(c_int(n_steps)),
287286
byref(c_double(time_interval)),
287+
byref(c_double(time_max)),
288288
byref(c_double(self.WaveTimeShift)),
289289
byref(self._numChannels),
290290
_channel_names,

modules/seastate/src/SeaState_C_Binding.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ end subroutine SeaSt_C_PreInit
196196

197197

198198
!> Initialize the library (PreInit must be called first)
199-
subroutine SeaSt_C_Init(InputFile_C, OutRootName_C, NSteps_C, TimeInterval_C, WaveTimeShift_C, NumChannels_C, OutputChannelNames_C, OutputChannelUnits_C, ErrStat_C, ErrMsg_C) BIND (C, NAME='SeaSt_C_Init')
199+
subroutine SeaSt_C_Init(InputFile_C, OutRootName_C, TimeInterval_C, TMax_C, WaveTimeShift_C, NumChannels_C, OutputChannelNames_C, OutputChannelUnits_C, ErrStat_C, ErrMsg_C) BIND (C, NAME='SeaSt_C_Init')
200200
#ifndef IMPLICIT_DLLEXPORT
201201
!DEC$ ATTRIBUTES DLLEXPORT :: SeaSt_C_Init
202202
!GCC$ ATTRIBUTES DLLEXPORT :: SeaSt_C_Init
203203
#endif
204204
character(kind=c_char), intent(in ) :: InputFile_C(IntfStrLen)
205205
character(kind=c_char), intent(in ) :: OutRootName_C(IntfStrLen)
206-
integer(c_int), intent(in ) :: NSteps_C
207206
real(c_double), intent(in ) :: TimeInterval_C
207+
real(c_double), intent(in ) :: TMax_c
208208
real(c_double), intent(in ) :: WaveTimeShift_C
209209
integer(c_int), intent( out) :: NumChannels_C
210210
character(kind=c_char), intent( out) :: OutputChannelNames_C(ChanLen*MaxOutPts+1)
@@ -251,7 +251,7 @@ subroutine SeaSt_C_Init(InputFile_C, OutRootName_C, NSteps_C, TimeInterval_C, Wa
251251

252252
! Set other inputs for calling SeaSt_Init
253253
InitInp%UseInputFile = .TRUE. ! don't allow passing of full file contents as a string
254-
InitInp%TMax = (NSteps_C - 1) * TimeInterval_C ! Using this to match the SeaState driver; could otherwise get TMax directly !FIXME: type conversion
254+
InitInp%TMax = real(TMax_c, DbKi)
255255
InitInp%WaveFieldMod = 0_IntKi
256256
InitInp%WrWvKinMod = 0_IntKi
257257
InitInp%Linearize = .false.
@@ -304,7 +304,7 @@ subroutine ShowPassedData()
304304
call WrScr(" --------------------------------------------------------")
305305
call WrScr(" InputFile_C -> "//trim(InitInp%InputFile))
306306
call WrScr(" OutRootName_C -> "//trim(InitInp%OutRootName))
307-
call WrScr(" NSteps_C -> "//trim(Num2LStr(NSteps_C)))
307+
call WrScr(" TMax_C -> "//trim(Num2LStr(TMax_C)))
308308
call WrScr(" TimeInterval_C -> "//trim(Num2LStr(TimeInterval_C)))
309309
call WrScr(" WaveTimeShift_C -> "//trim(Num2LStr(WaveTimeShift_C)))
310310
call WrScr("-----------------------------------------------------------")

0 commit comments

Comments
 (0)