Skip to content

Commit

Permalink
Merge pull request #2569 from andrew-platt/b/Lidar_SegFault
Browse files Browse the repository at this point in the history
Disable LiDAR in IfW at FAST.Farm level
  • Loading branch information
andrew-platt authored Dec 19, 2024
2 parents 5c30c42 + a8fe70e commit ee85fef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/inflowwind/src/InflowWind.f90
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,16 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons
p%lidar%PulseSpacing = InputFileData%PulseSpacing
p%lidar%URefLid = InputFileData%URefLid
p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion


! Disable Lidar if not allowed (FAST.Farm doesn't allow this)
if (.not. InitInp%LidarEnabled) then
if (p%lidar%SensorType /= SensorType_None) then
call WrScr(' WARNING: LiDAR cannot be used with this instance of InflowWind (not usable with FAST.Farm).')
call WrScr(' --> Disabling LiDAR.')
p%lidar%SensorType = SensorType_None
end if
endif


CALL Lidar_Init( InitInp, InputGuess, p, ContStates, DiscStates, ConstrStateGuess, OtherStates, &
y, m, TimeInterval, InitOutData, TmpErrStat, TmpErrMsg )
Expand Down
1 change: 1 addition & 0 deletions modules/inflowwind/src/InflowWind.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef ^ ^ ReKi WtrDpth
typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level" m
typedef ^ ^ IntKi BoxExceedAllowIdx - -1 - "Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim)" -
typedef ^ ^ LOGICAL BoxExceedAllowF - .FALSE. - "Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim)" -
typedef ^ ^ LOGICAL LidarEnabled - .false. - "Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible)" -


# Init Output
Expand Down
7 changes: 7 additions & 0 deletions modules/inflowwind/src/InflowWind_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ MODULE InflowWind_Types
REAL(ReKi) :: MSL2SWL !< Mean sea level to still water level [m]
INTEGER(IntKi) :: BoxExceedAllowIdx = -1 !< Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim) [-]
LOGICAL :: BoxExceedAllowF = .FALSE. !< Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim) [-]
LOGICAL :: LidarEnabled = .false. !< Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible) [-]
END TYPE InflowWind_InitInputType
! =======================
! ========= InflowWind_InitOutputType =======
Expand Down Expand Up @@ -1110,6 +1111,7 @@ SUBROUTINE InflowWind_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCod
DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL
DstInitInputData%BoxExceedAllowIdx = SrcInitInputData%BoxExceedAllowIdx
DstInitInputData%BoxExceedAllowF = SrcInitInputData%BoxExceedAllowF
DstInitInputData%LidarEnabled = SrcInitInputData%LidarEnabled
END SUBROUTINE InflowWind_CopyInitInput

SUBROUTINE InflowWind_DestroyInitInput( InitInputData, ErrStat, ErrMsg, DEALLOCATEpointers )
Expand Down Expand Up @@ -1263,6 +1265,7 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat
Re_BufSz = Re_BufSz + 1 ! MSL2SWL
Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowIdx
Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowF
Int_BufSz = Int_BufSz + 1 ! LidarEnabled
IF ( Re_BufSz .GT. 0 ) THEN
ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 )
IF (ErrStat2 /= 0) THEN
Expand Down Expand Up @@ -1438,6 +1441,8 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat
Int_Xferred = Int_Xferred + 1
IntKiBuf(Int_Xferred) = TRANSFER(InData%BoxExceedAllowF, IntKiBuf(1))
Int_Xferred = Int_Xferred + 1
IntKiBuf(Int_Xferred) = TRANSFER(InData%LidarEnabled, IntKiBuf(1))
Int_Xferred = Int_Xferred + 1
END SUBROUTINE InflowWind_PackInitInput

SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg )
Expand Down Expand Up @@ -1662,6 +1667,8 @@ SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS
Int_Xferred = Int_Xferred + 1
OutData%BoxExceedAllowF = TRANSFER(IntKiBuf(Int_Xferred), OutData%BoxExceedAllowF)
Int_Xferred = Int_Xferred + 1
OutData%LidarEnabled = TRANSFER(IntKiBuf(Int_Xferred), OutData%LidarEnabled)
Int_Xferred = Int_Xferred + 1
END SUBROUTINE InflowWind_UnPackInitInput

SUBROUTINE InflowWind_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg )
Expand Down
1 change: 1 addition & 0 deletions modules/openfast-library/src/FAST_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
END IF

! lidar
Init%InData_IfW%LidarEnabled = .true. ! allowed with OF, but not FF
Init%InData_IfW%lidar%Tmax = p_FAST%TMax
Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1)

Expand Down

0 comments on commit ee85fef

Please sign in to comment.