Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/aerodyn/src/AeroDyn_Inflow.f90
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ subroutine ADI_InitInflowWind(Root, i_IW, u_AD, o_AD, IW, dt, InitOutData, errSt
! the average values for the entire wind profile must be calculated and stored (we don't know if OLAF
! is used until after AD_Init below).
InitInData%BoxExceedAllow = .true.

!bjj: what about these initialization inputs?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I don't know offhand. Thanks for adding the comment -- hopefully we get around to addressing it a some point.

! InitInData%HubPosition
! InitInData%RadAvg

CALL InflowWind_Init( InitInData, IW%u, IW%p, &
IW%x, IW%xd, IW%z, IW%OtherSt, &
IW%y, IW%m, dt, InitOutData, errStat2, errMsg2 )
Expand Down
4 changes: 1 addition & 3 deletions modules/awae/src/AWAE.f90
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,7 @@ subroutine AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO
IfW_InitInp%RootName = TRIM(p%OutFileRoot)//'.IfW'
IfW_InitInp%FilePassingMethod = 0_IntKi ! Read IfW input file from disk
IfW_InitInp%InputFileName = InitInp%InputFileData%InflowFile
IfW_InitInp%lidar%Tmax = 0.0_ReKi
IfW_InitInp%lidar%HubPosition = 0.0_ReKi
IfW_InitInp%lidar%SensorType = SensorType_None
IfW_InitInp%HubPosition = 0.0_ReKi
IfW_InitInp%Use4Dext = .false.
IfW_InitInp%MHK = MHK_None
IfW_InitInp%WtrDpth = 0.0_ReKi
Expand Down
27 changes: 5 additions & 22 deletions modules/inflowwind/src/InflowWind.f90
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,8 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons
endif

! initialize sensor data:
p%lidar%SensorType = InputFileData%SensorType
IF (InputFileData%SensorType /= SensorType_None) THEN
p%lidar%NumBeam = InputFileData%NumBeam
p%lidar%RotorApexOffsetPos = InputFileData%RotorApexOffsetPos
p%lidar%LidRadialVel = InputFileData%LidRadialVel
p%lidar%NumPulseGate = InputFileData%NumPulseGate
p%lidar%FocalDistanceX = InputFileData%FocalDistanceX ! these are allocatable. Should allocate then copy
p%lidar%FocalDistanceY = InputFileData%FocalDistanceY
p%lidar%FocalDistanceZ = InputFileData%FocalDistanceZ
p%lidar%MeasurementInterval= InputFileData%MeasurementInterval
p%lidar%PulseSpacing = InputFileData%PulseSpacing
p%lidar%URefLid = InputFileData%URefLid
p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion

CALL Lidar_Init( InitInp, InputGuess, p, ContStates, DiscStates, ConstrStateGuess, OtherStates, &
y, m, TimeInterval, InitOutData, TmpErrStat, TmpErrMsg ); if (Failed()) return
endif
CALL Lidar_Init( InitInp, InputFileData, InputGuess, p, y, m, TimeInterval, TmpErrStat, TmpErrMsg )
if (Failed()) return

! If a summary file was requested, open it.
IF ( InputFileData%SumPrint ) THEN
Expand All @@ -216,7 +201,7 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons
! Allocate the array for passing points
CALL AllocAry( InputGuess%PositionXYZ, 3, InitInp%NumWindPoints, "Array of positions at which to find wind velocities", TmpErrStat, TmpErrMsg ); if (Failed()) return
InputGuess%PositionXYZ = 0.0_ReKi
InputGuess%HubPosition = 0.0_ReKi
InputGuess%HubPosition = InitInp%HubPosition
CALL Eye(InputGuess%HubOrientation,TmpErrStat,TmpErrMsg); if (Failed()) return

! Allocate the array for passing velocities out
Expand Down Expand Up @@ -619,12 +604,10 @@ SUBROUTINE InflowWind_CalcOutput( Time, InputData, p, &
! return sensor values
IF (p%lidar%SensorType /= SensorType_None) THEN

CALL Lidar_CalcOutput(Time, InputData, p, &
ContStates, DiscStates, ConstrStates, OtherStates, &
OutputData, m, TmpErrStat, TmpErrMsg )
CALL Lidar_CalcOutput(Time, InputData, p, OutputData, m, TmpErrStat, TmpErrMsg )
CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )

END IF
END IF


!-----------------------------
Expand Down
4 changes: 2 additions & 2 deletions modules/inflowwind/src/InflowWind.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef ^ ^ ReKi PulseSpacin
typedef ^ ^ ReKi MeasurementInterval - - - "Time between each measurement" s
typedef ^ ^ ReKi URefLid - - - "Reference average wind speed for the lidar" m/s
typedef ^ ^ LOGICAL LidRadialVel - - - "TRUE => return radial component, FALSE => return 'x' direction estimate" -
typedef ^ ^ IntKi ConsiderHubMotion - - - "Flag whether or not the hub motion's impact on the Lidar measurement will be considered [0 for no, 1 for yes]" -
typedef ^ ^ IntKi ConsiderHubMotion - - - "whether or not the hub motion's impact on the Lidar measurement will be considered" -
typedef ^ ^ Grid3D_InitInputType FF - - - "scaling data" -


Expand All @@ -92,14 +92,14 @@ typedef ^ ^ IntKi FilePassing
typedef ^ ^ FileInfoType PassedFileInfo - - - "If we don't use the input file, pass everything through this [FilePassingMethod = 1]" -
typedef ^ ^ InflowWind_InputFile PassedFileData - - - "If we don't use the input file, pass everything through this [FilePassingMethod = 2]" -
typedef ^ ^ LOGICAL OutputAccel - .FALSE. - "Flag to output wind acceleration" -
typedef ^ ^ Lidar_InitInputType lidar - - - "InitInput for lidar data" -
typedef ^ ^ Grid4D_InitInputType FDext - - - "InitInput for 4D external wind data" -
typedef ^ ^ ReKi RadAvg - - - "Radius (from hub) used for averaging wind speed" -
typedef ^ ^ IntKi MHK - - - "MHK turbine type switch" -
typedef ^ ^ ReKi WtrDpth - - - "Water depth" m
typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level" m
typedef ^ ^ LOGICAL BoxExceedAllow - .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)" -
typedef ^ ^ ReKi HubPosition {3} - - "initial position of the hub (lidar mounted on hub) [0,0,HubHeight]" "m"


# Init Output
Expand Down
52 changes: 17 additions & 35 deletions modules/inflowwind/src/InflowWind_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,14 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In
CALL ParseVar( InFileInfo, CurLine, "NumBeam", InputFileData%NumBeam, TmpErrStat, TmpErrMsg, UnEc )
if (Failed()) return

! Before proceeding, make sure that NumBeam makes sense
IF ((InputFileData%SensorType == 1) .and. (InputFileData%NumBeam < 1 .OR. InputFileData%NumBeam > 5)) THEN
CALL SetErrStat( ErrID_Fatal, 'NumBeam must be greater than or equal to one and less than 6.', &
ErrStat, ErrMsg, RoutineName )
RETURN
ELSE
! Allocate space for the output location arrays:
CALL AllocAry( InputFileData%FocalDistanceX, InputFileData%NumBeam, 'FocalDistanceX', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
CALL AllocAry( InputFileData%FocalDistanceY, InputFileData%NumBeam, 'FocalDistanceY', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
CALL AllocAry( InputFileData%FocalDistanceZ, InputFileData%NumBeam, 'FocalDistanceZ', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
if (Failed()) return
ENDIF
! Before proceeding, make sure that NumBeam makes sense for array allocation
InputFileData%NumBeam = MAX(InputFileData%NumBeam, 1)

! Allocate space for the output location arrays:
CALL AllocAry( InputFileData%FocalDistanceX, InputFileData%NumBeam, 'FocalDistanceX', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
CALL AllocAry( InputFileData%FocalDistanceY, InputFileData%NumBeam, 'FocalDistanceY', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
CALL AllocAry( InputFileData%FocalDistanceZ, InputFileData%NumBeam, 'FocalDistanceZ', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName )
if (Failed()) return

! Focal Distance X
CALL ParseAry( InFileInfo, CurLine, 'FocalDistanceX', InputFileData%FocalDistanceX, InputFileData%NumBeam, TmpErrStat, TmpErrMsg, UnEc )
Expand Down Expand Up @@ -647,7 +643,7 @@ SUBROUTINE InflowWind_ValidateInput( InitInp, InputFileData, ErrStat, ErrMsg )
return
end if

if (InitInp%lidar%SensorType /= SensorType_None) then
if (InputFileData%SensorType /= SensorType_None) then
call SetErrStat(ErrID_Fatal, 'InflowWind can not perform linearization with the lidar module enabled.', ErrStat, ErrMsg, RoutineName)
return
end if
Expand Down Expand Up @@ -1177,7 +1173,7 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg )
! Passed variables

CHARACTER(ChanLen), INTENT(IN) :: OutList(:) !< The list of user-requested outputs
TYPE(InflowWind_ParameterType), INTENT(INOUT) :: p !< The module parameters
TYPE(InflowWind_ParameterType), INTENT(INOUT) :: p !< The module parameters
INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code
CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred

Expand Down Expand Up @@ -1288,17 +1284,9 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg )
InvalidOutput(WindAccZ) = .TRUE.
end if

if (p%lidar%SensorType /= SensorType_None) then
IF (p%lidar%SensorType == SensorType_SinglePoint) THEN
DO I=p%lidar%NumBeam+1,5
InvalidOutput( WindMeas(I) ) = .TRUE.
END DO
ELSE
DO I=p%lidar%NumPulseGate+1,5
InvalidOutput( WindMeas(I) ) = .TRUE.
END DO
END IF
endif
do I=p%lidar%NumMeasurements+1,SIZE(WindMeas)
InvalidOutput( WindMeas(I) ) = .TRUE.
end do

! ................. End of validity checking .................

Expand Down Expand Up @@ -1521,16 +1509,10 @@ SUBROUTINE SetAllOuts( p, y, m, ErrStat, ErrMsg )


!FIXME: Add in Wind1Dir etc. -- although those can be derived outside of FAST.
if (p%lidar%SensorType /= SensorType_None) then
IF ( p%lidar%SensorType == SensorType_SinglePoint) THEN
DO I = 1,MIN(5, p%lidar%NumBeam )
m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I)
END DO
ELSE
DO I = 1,MIN(5, p%lidar%NumPulseGate )
m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I)
END DO
END IF
if (ALLOCATED(y%lidar%LidSpeed)) then
DO I = 1,MIN(SIZE(WindMeas), SIZE(y%lidar%LidSpeed) )
m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I)
END DO
endif

END SUBROUTINE SetAllOuts
Expand Down
14 changes: 5 additions & 9 deletions modules/inflowwind/src/InflowWind_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ MODULE InflowWind_Types
REAL(ReKi) :: MeasurementInterval = 0.0_ReKi !< Time between each measurement [s]
REAL(ReKi) :: URefLid = 0.0_ReKi !< Reference average wind speed for the lidar [m/s]
LOGICAL :: LidRadialVel = .false. !< TRUE => return radial component, FALSE => return 'x' direction estimate [-]
INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< Flag whether or not the hub motion's impact on the Lidar measurement will be considered [0 for no, 1 for yes] [-]
INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< whether or not the hub motion's impact on the Lidar measurement will be considered [-]
TYPE(Grid3D_InitInputType) :: FF !< scaling data [-]
END TYPE InflowWind_InputFile
! =======================
Expand All @@ -111,14 +111,14 @@ MODULE InflowWind_Types
TYPE(FileInfoType) :: PassedFileInfo !< If we don't use the input file, pass everything through this [FilePassingMethod = 1] [-]
TYPE(InflowWind_InputFile) :: PassedFileData !< If we don't use the input file, pass everything through this [FilePassingMethod = 2] [-]
LOGICAL :: OutputAccel = .FALSE. !< Flag to output wind acceleration [-]
TYPE(Lidar_InitInputType) :: lidar !< InitInput for lidar data [-]
TYPE(Grid4D_InitInputType) :: FDext !< InitInput for 4D external wind data [-]
REAL(ReKi) :: RadAvg = 0.0_ReKi !< Radius (from hub) used for averaging wind speed [-]
INTEGER(IntKi) :: MHK = 0_IntKi !< MHK turbine type switch [-]
REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [m]
REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Mean sea level to still water level [m]
LOGICAL :: BoxExceedAllow = .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) [-]
REAL(ReKi) , DIMENSION(1:3) :: HubPosition = 0.0_ReKi !< initial position of the hub (lidar mounted on hub) [0,0,HubHeight] [m]
END TYPE InflowWind_InitInputType
! =======================
! ========= InflowWind_InitOutputType =======
Expand Down Expand Up @@ -511,9 +511,6 @@ subroutine InflowWind_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
DstInitInputData%OutputAccel = SrcInitInputData%OutputAccel
call Lidar_CopyInitInput(SrcInitInputData%lidar, DstInitInputData%lidar, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
call InflowWind_IO_CopyGrid4D_InitInputType(SrcInitInputData%FDext, DstInitInputData%FDext, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
Expand All @@ -523,6 +520,7 @@ subroutine InflowWind_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode
DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL
DstInitInputData%BoxExceedAllow = SrcInitInputData%BoxExceedAllow
DstInitInputData%LidarEnabled = SrcInitInputData%LidarEnabled
DstInitInputData%HubPosition = SrcInitInputData%HubPosition
end subroutine

subroutine InflowWind_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
Expand All @@ -538,8 +536,6 @@ subroutine InflowWind_DestroyInitInput(InitInputData, ErrStat, ErrMsg)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call InflowWind_DestroyInputFile(InitInputData%PassedFileData, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call Lidar_DestroyInitInput(InitInputData%lidar, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call InflowWind_IO_DestroyGrid4D_InitInputType(InitInputData%FDext, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
end subroutine
Expand All @@ -560,14 +556,14 @@ subroutine InflowWind_PackInitInput(RF, Indata)
call NWTC_Library_PackFileInfoType(RF, InData%PassedFileInfo)
call InflowWind_PackInputFile(RF, InData%PassedFileData)
call RegPack(RF, InData%OutputAccel)
call Lidar_PackInitInput(RF, InData%lidar)
call InflowWind_IO_PackGrid4D_InitInputType(RF, InData%FDext)
call RegPack(RF, InData%RadAvg)
call RegPack(RF, InData%MHK)
call RegPack(RF, InData%WtrDpth)
call RegPack(RF, InData%MSL2SWL)
call RegPack(RF, InData%BoxExceedAllow)
call RegPack(RF, InData%LidarEnabled)
call RegPack(RF, InData%HubPosition)
if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand All @@ -587,14 +583,14 @@ subroutine InflowWind_UnPackInitInput(RF, OutData)
call NWTC_Library_UnpackFileInfoType(RF, OutData%PassedFileInfo) ! PassedFileInfo
call InflowWind_UnpackInputFile(RF, OutData%PassedFileData) ! PassedFileData
call RegUnpack(RF, OutData%OutputAccel); if (RegCheckErr(RF, RoutineName)) return
call Lidar_UnpackInitInput(RF, OutData%lidar) ! lidar
call InflowWind_IO_UnpackGrid4D_InitInputType(RF, OutData%FDext) ! FDext
call RegUnpack(RF, OutData%RadAvg); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%MHK); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%WtrDpth); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%MSL2SWL); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%BoxExceedAllow); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%LidarEnabled); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%HubPosition); if (RegCheckErr(RF, RoutineName)) return
end subroutine

subroutine InflowWind_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg)
Expand Down
Loading