Skip to content

Commit

Permalink
Merge pull request #1784 from andrew-platt/f/ADI_c_binding_multiRotor
Browse files Browse the repository at this point in the history
Multi-rotor support in ADI c-bindings interface
  • Loading branch information
andrew-platt authored Oct 11, 2023
2 parents 7091e85 + 24c05a7 commit bb9a8aa
Show file tree
Hide file tree
Showing 12 changed files with 1,325 additions and 784 deletions.
467 changes: 242 additions & 225 deletions modules/aerodyn/python-lib/aerodyn_inflow_library.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ subroutine Init_u( u, p, p_AD, InputFileData, MHK, WtrDpth, InitInp, errStat, er
if (errStat >= AbortErrLev) return

! set node initial position/orientation
position = 0.0_ReKi
position = InitInp%originInit
do j=1,p%NumTwrNds
IF ( MHK == MHK_FixedBottom ) THEN
position(3) = InputFileData%TwrElev(j) - WtrDpth
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn_Driver_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ typedef ^ ^ ReKi Patm
typedef ^ ^ ReKi Pvap - - - "Vapour pressure of working fluid" "Pa"
typedef ^ ^ ReKi WtrDpth - - - "Water depth" "m"
typedef ^ ^ ReKi MSL2SWL - - - "Offset between still-water level and mean sea level" "m"
typedef ^ ^ IntKi numTurbines - - - "number of blades on turbine" "-"
typedef ^ ^ IntKi numTurbines - -9999 - "number of turbine rotors" "-"
typedef ^ ^ WTData WT : - - "Wind turbine data for driver" "-"
typedef ^ ^ DbKi dT - - - "time increment" "s"
typedef ^ ^ DbKi tMax - - - "time increment" "s"
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn_Driver_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ MODULE AeroDyn_Driver_Types
REAL(ReKi) :: Pvap = 0.0_ReKi !< Vapour pressure of working fluid [Pa]
REAL(ReKi) :: WtrDpth = 0.0_ReKi !< Water depth [m]
REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Offset between still-water level and mean sea level [m]
INTEGER(IntKi) :: numTurbines = 0_IntKi !< number of blades on turbine [-]
INTEGER(IntKi) :: numTurbines = -9999 !< number of turbine rotors [-]
TYPE(WTData) , DIMENSION(:), ALLOCATABLE :: WT !< Wind turbine data for driver [-]
REAL(DbKi) :: dT = 0.0_R8Ki !< time increment [s]
REAL(DbKi) :: tMax = 0.0_R8Ki !< time increment [s]
Expand Down
1,615 changes: 1,061 additions & 554 deletions modules/aerodyn/src/AeroDyn_Inflow_C_Binding.f90

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions modules/aerodyn/src/AeroDyn_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ typedef ^ ^ SiKi TowerRad
# ..... Initialization data .......................................................................................................
# Define inputs that the initialization routine may need here:
typedef AeroDyn/AD RotInitInputType IntKi NumBlades - - - "Number of blades on the turbine" -
typedef ^ RotInitInputType ReKi originInit {3} - 0 "X-Y-Z reference position for the turbine" m
typedef ^ RotInitInputType ReKi HubPosition {3} - - "X-Y-Z reference position of hub" m
typedef ^ RotInitInputType R8Ki HubOrientation {3}{3} - - "DCM reference orientation of hub" -
typedef ^ RotInitInputType ReKi BladeRootPosition {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m
Expand Down
5 changes: 5 additions & 0 deletions modules/aerodyn/src/AeroDyn_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ MODULE AeroDyn_Types
! ========= RotInitInputType =======
TYPE, PUBLIC :: RotInitInputType
INTEGER(IntKi) :: NumBlades = 0_IntKi !< Number of blades on the turbine [-]
REAL(ReKi) , DIMENSION(1:3) :: originInit = 0.0_ReKi !< X-Y-Z reference position for the turbine [m]
REAL(ReKi) , DIMENSION(1:3) :: HubPosition = 0.0_ReKi !< X-Y-Z reference position of hub [m]
REAL(R8Ki) , DIMENSION(1:3,1:3) :: HubOrientation = 0.0_R8Ki !< DCM reference orientation of hub [-]
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BladeRootPosition !< X-Y-Z reference position of each blade root (3 x NumBlades) [m]
Expand Down Expand Up @@ -834,6 +835,7 @@ subroutine AD_CopyRotInitInputType(SrcRotInitInputTypeData, DstRotInitInputTypeD
ErrStat = ErrID_None
ErrMsg = ''
DstRotInitInputTypeData%NumBlades = SrcRotInitInputTypeData%NumBlades
DstRotInitInputTypeData%originInit = SrcRotInitInputTypeData%originInit
DstRotInitInputTypeData%HubPosition = SrcRotInitInputTypeData%HubPosition
DstRotInitInputTypeData%HubOrientation = SrcRotInitInputTypeData%HubOrientation
if (allocated(SrcRotInitInputTypeData%BladeRootPosition)) then
Expand Down Expand Up @@ -888,6 +890,7 @@ subroutine AD_PackRotInitInputType(Buf, Indata)
character(*), parameter :: RoutineName = 'AD_PackRotInitInputType'
if (Buf%ErrStat >= AbortErrLev) return
call RegPack(Buf, InData%NumBlades)
call RegPack(Buf, InData%originInit)
call RegPack(Buf, InData%HubPosition)
call RegPack(Buf, InData%HubOrientation)
call RegPack(Buf, allocated(InData%BladeRootPosition))
Expand Down Expand Up @@ -918,6 +921,8 @@ subroutine AD_UnPackRotInitInputType(Buf, OutData)
if (Buf%ErrStat /= ErrID_None) return
call RegUnpack(Buf, OutData%NumBlades)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%originInit)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%HubPosition)
if (RegCheckErr(Buf, RoutineName)) return
call RegUnpack(Buf, OutData%HubOrientation)
Expand Down
5 changes: 4 additions & 1 deletion modules/aerodyn/src/FVW.f90
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,10 @@ subroutine FVW_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, AFInfo, m
m%ComputeWakeInduced = .FALSE.
endif
if (bReevaluation) then
call WrScr('[INFO] FVW: Update States: reevaluation at the same starting time')
if (m%InfoReEval) then
call WrScr('[INFO] FVW: Update States: reevaluation at the same starting time. This will not print on subsequent occurences.')
m%InfoReEval = .false.
endif
call RollBackPreviousTimeStep() ! Cancel wake emission done in previous call
m%ComputeWakeInduced = .TRUE.
endif
Expand Down
1 change: 1 addition & 0 deletions modules/aerodyn/src/FVW_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi Uind :: - - "Induced velocities obtained at control points" -
# Outputs
typedef ^ ^ GridOutType GridOutputs {:} - - "Number of VTK grid to output" -
typedef ^ ^ Logical InfoReeval - .true. - "Give info about Reevaluation: gets set to false after first info statement" -

# ........ Input ............
# Rotors
Expand Down
5 changes: 5 additions & 0 deletions modules/aerodyn/src/FVW_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ MODULE FVW_Types
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: CPs !< Control points used for wake rollup computation [-]
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Uind !< Induced velocities obtained at control points [-]
TYPE(GridOutType) , DIMENSION(:), ALLOCATABLE :: GridOutputs !< Number of VTK grid to output [-]
LOGICAL :: InfoReeval = .true. !< Give info about Reevaluation: gets set to false after first info statement [-]
END TYPE FVW_MiscVarType
! =======================
! ========= Rot_InputType =======
Expand Down Expand Up @@ -3531,6 +3532,7 @@ subroutine FVW_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg)
if (ErrStat >= AbortErrLev) return
end do
end if
DstMiscData%InfoReeval = SrcMiscData%InfoReeval
end subroutine

subroutine FVW_DestroyMisc(MiscData, ErrStat, ErrMsg)
Expand Down Expand Up @@ -3639,6 +3641,7 @@ subroutine FVW_PackMisc(Buf, Indata)
call FVW_PackGridOutType(Buf, InData%GridOutputs(i1))
end do
end if
call RegPack(Buf, InData%InfoReeval)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine

Expand Down Expand Up @@ -3750,6 +3753,8 @@ subroutine FVW_UnPackMisc(Buf, OutData)
call FVW_UnpackGridOutType(Buf, OutData%GridOutputs(i1)) ! GridOutputs
end do
end if
call RegUnpack(Buf, OutData%InfoReeval)
if (RegCheckErr(Buf, RoutineName)) return
end subroutine

subroutine FVW_CopyRot_InputType(SrcRot_InputTypeData, DstRot_InputTypeData, CtrlCode, ErrStat, ErrMsg)
Expand Down
2 changes: 2 additions & 0 deletions reg_tests/CTestList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ ad_regression("ad_BAR_OLAF" "aerodyn;bem")
ad_regression("ad_BAR_SineMotion" "aerodyn;bem")
ad_regression("ad_BAR_SineMotion_UA4_DBEMT3" "aerodyn;bem")
ad_regression("ad_BAR_RNAMotion" "aerodyn;bem")
ad_regression("ad_B1n2_OLAF" "aerodyn;OLAF")
py_ad_regression("py_ad_5MW_OC4Semi_WSt_WavesWN" "aerodyn;bem;python")
py_ad_regression("py_ad_B1n2_OLAF" "aerodyn;OLAF;python")

# UnsteadyAero
ua_regression("ua_redfreq" "unsteadyaero")
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 263 files

0 comments on commit bb9a8aa

Please sign in to comment.