Skip to content

Commit ee85fef

Browse files
authored
Merge pull request #2569 from andrew-platt/b/Lidar_SegFault
Disable LiDAR in IfW at FAST.Farm level
2 parents 5c30c42 + a8fe70e commit ee85fef

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

modules/inflowwind/src/InflowWind.f90

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,16 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons
224224
p%lidar%PulseSpacing = InputFileData%PulseSpacing
225225
p%lidar%URefLid = InputFileData%URefLid
226226
p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion
227-
227+
228+
! Disable Lidar if not allowed (FAST.Farm doesn't allow this)
229+
if (.not. InitInp%LidarEnabled) then
230+
if (p%lidar%SensorType /= SensorType_None) then
231+
call WrScr(' WARNING: LiDAR cannot be used with this instance of InflowWind (not usable with FAST.Farm).')
232+
call WrScr(' --> Disabling LiDAR.')
233+
p%lidar%SensorType = SensorType_None
234+
end if
235+
endif
236+
228237

229238
CALL Lidar_Init( InitInp, InputGuess, p, ContStates, DiscStates, ConstrStateGuess, OtherStates, &
230239
y, m, TimeInterval, InitOutData, TmpErrStat, TmpErrMsg )

modules/inflowwind/src/InflowWind.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ typedef ^ ^ ReKi WtrDpth
101101
typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level" m
102102
typedef ^ ^ IntKi BoxExceedAllowIdx - -1 - "Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim)" -
103103
typedef ^ ^ LOGICAL BoxExceedAllowF - .FALSE. - "Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim)" -
104+
typedef ^ ^ LOGICAL LidarEnabled - .false. - "Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible)" -
104105

105106

106107
# Init Output

modules/inflowwind/src/InflowWind_Types.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ MODULE InflowWind_Types
119119
REAL(ReKi) :: MSL2SWL !< Mean sea level to still water level [m]
120120
INTEGER(IntKi) :: BoxExceedAllowIdx = -1 !< Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim) [-]
121121
LOGICAL :: BoxExceedAllowF = .FALSE. !< Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim) [-]
122+
LOGICAL :: LidarEnabled = .false. !< Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible) [-]
122123
END TYPE InflowWind_InitInputType
123124
! =======================
124125
! ========= InflowWind_InitOutputType =======
@@ -1110,6 +1111,7 @@ SUBROUTINE InflowWind_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCod
11101111
DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL
11111112
DstInitInputData%BoxExceedAllowIdx = SrcInitInputData%BoxExceedAllowIdx
11121113
DstInitInputData%BoxExceedAllowF = SrcInitInputData%BoxExceedAllowF
1114+
DstInitInputData%LidarEnabled = SrcInitInputData%LidarEnabled
11131115
END SUBROUTINE InflowWind_CopyInitInput
11141116

11151117
SUBROUTINE InflowWind_DestroyInitInput( InitInputData, ErrStat, ErrMsg, DEALLOCATEpointers )
@@ -1263,6 +1265,7 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat
12631265
Re_BufSz = Re_BufSz + 1 ! MSL2SWL
12641266
Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowIdx
12651267
Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowF
1268+
Int_BufSz = Int_BufSz + 1 ! LidarEnabled
12661269
IF ( Re_BufSz .GT. 0 ) THEN
12671270
ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 )
12681271
IF (ErrStat2 /= 0) THEN
@@ -1438,6 +1441,8 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat
14381441
Int_Xferred = Int_Xferred + 1
14391442
IntKiBuf(Int_Xferred) = TRANSFER(InData%BoxExceedAllowF, IntKiBuf(1))
14401443
Int_Xferred = Int_Xferred + 1
1444+
IntKiBuf(Int_Xferred) = TRANSFER(InData%LidarEnabled, IntKiBuf(1))
1445+
Int_Xferred = Int_Xferred + 1
14411446
END SUBROUTINE InflowWind_PackInitInput
14421447

14431448
SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg )
@@ -1662,6 +1667,8 @@ SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS
16621667
Int_Xferred = Int_Xferred + 1
16631668
OutData%BoxExceedAllowF = TRANSFER(IntKiBuf(Int_Xferred), OutData%BoxExceedAllowF)
16641669
Int_Xferred = Int_Xferred + 1
1670+
OutData%LidarEnabled = TRANSFER(IntKiBuf(Int_Xferred), OutData%LidarEnabled)
1671+
Int_Xferred = Int_Xferred + 1
16651672
END SUBROUTINE InflowWind_UnPackInitInput
16661673

16671674
SUBROUTINE InflowWind_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg )

modules/openfast-library/src/FAST_Subs.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
583583
END IF
584584

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

0 commit comments

Comments
 (0)