Skip to content

Commit

Permalink
AD: AFAeroMod=1 <> UAMod=0
Browse files Browse the repository at this point in the history
  • Loading branch information
ebranlard committed Dec 1, 2023
1 parent 834a81e commit 08edd1b
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 96 deletions.
31 changes: 12 additions & 19 deletions modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,13 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut
! bjj: do we put a warning here if any of these values aren't currently set this way?
if (InitInp%CompAeroMaps) then
InputFileData%DTAero = interval ! we're not using this, so set it to something "safe"
do iR = 1, nRotors
InputFileData%AFAeroMod = AFAeroMod_Steady
InputFileData%TwrPotent = TwrPotent_none
InputFileData%TwrShadow = TwrShadow_none
InputFileData%TwrAero = .false.
!InputFileData%CavitCheck = .false.
!InputFileData%TFinAero = .false. ! not sure if this needs to be set or not
end do
InputFileData%DBEMT_Mod = 0
InputFileData%UAMod = UA_None
InputFileData%TwrPotent = TwrPotent_none
InputFileData%TwrShadow = TwrShadow_none
InputFileData%TwrAero = .false.
!InputFileData%CavitCheck = .false.
!InputFileData%TFinAero = .false. ! not sure if this needs to be set or not
InputFileData%DBEMT_Mod = DBEMT_none
end if

! Validate the inputs
Expand Down Expand Up @@ -1318,7 +1316,7 @@ subroutine SetParameters( InitInp, InputFileData, RotData, p, p_AD, ErrStat, Err

! NOTE: p_AD%FlowField is set in the glue code (or ADI module); seems like FlowField should be an initialization input so that would be clearer for new developers...

p_AD%UA_Flag = InputFileData%AFAeroMod == AFAeroMod_BL_unsteady
p_AD%UA_Flag = InputFileData%UAMod > UA_None
p_AD%CompAeroMaps = InitInp%CompAeroMaps

p_AD%SectAvg = InputFileData%SectAvg
Expand Down Expand Up @@ -3797,10 +3795,6 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg )
trim(num2lstr(WakeMod_DBEMT))//' (DBEMT), or '//trim(num2lstr(WakeMod_FVW))//' (FVW).',ErrStat, ErrMsg, RoutineName )
end if

if (InputFileData%AFAeroMod /= AFAeroMod_Steady .and. InputFileData%AFAeroMod /= AFAeroMod_BL_unsteady) then
call SetErrStat ( ErrID_Fatal, 'AFAeroMod must be '//trim(num2lstr(AFAeroMod_Steady))//' (steady) or '//&
trim(num2lstr(AFAeroMod_BL_unsteady))//' (Beddoes-Leishman unsteady).', ErrStat, ErrMsg, RoutineName )
end if
if (InputFileData%TwrPotent /= TwrPotent_none .and. InputFileData%TwrPotent /= TwrPotent_baseline .and. InputFileData%TwrPotent /= TwrPotent_Bak) then
call SetErrStat ( ErrID_Fatal, 'TwrPotent must be 0 (none), 1 (baseline potential flow), or 2 (potential flow with Bak correction).', ErrStat, ErrMsg, RoutineName )
end if
Expand Down Expand Up @@ -3866,7 +3860,7 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg )
end if !BEMT/DBEMT checks


if ( InputFileData%CavitCheck .and. InputFileData%AFAeroMod == AFAeroMod_BL_unsteady) then
if ( InputFileData%CavitCheck .and. InputFileData%UAMod >0) then
call SetErrStat( ErrID_Fatal, 'Cannot use unsteady aerodynamics module with a cavitation check', ErrStat, ErrMsg, RoutineName )
end if

Expand Down Expand Up @@ -4062,14 +4056,13 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg )
! check for linearization
!..................
if (InitInp%Linearize) then
if (InputFileData%AFAeroMod /= AFAeroMod_Steady) then
if (InputFileData%UAMod /= UA_HGM .and. InputFileData%UAMod /= UA_HGMV .and. InputFileData%UAMod /= UA_OYE) then
call SetErrStat( ErrID_Fatal, 'When AFAeroMod=2, UAMod must be 4, 5, or 6 for linearization. Set AFAeroMod=1, or, set UAMod=4, 5, or 6.', ErrStat, ErrMsg, RoutineName )
end if
if (InputFileData%UAMod /= UA_None .and. InputFileData%UAMod /= UA_HGM .and. InputFileData%UAMod /= UA_HGMV .and. InputFileData%UAMod /= UA_OYE) then
call SetErrStat( ErrID_Fatal, 'UAMod must be 0, 4, 5, or 6 for linearization.', ErrStat, ErrMsg, RoutineName )
end if

if (InputFileData%WakeMod == WakeMod_FVW) then !bjj: note: among other things, WriteOutput values will not be calculated properly in AD Jacobians if FVW this is allowed
call SetErrStat( ErrID_Fatal, 'FVW cannot currently be used for linearization. Set WakeMod=0 or WakeMod=1.', ErrStat, ErrMsg, RoutineName )

else if (InputFileData%WakeMod == WakeMod_DBEMT) then
if (InputFileData%DBEMT_Mod /= DBEMT_cont_tauConst) then
call SetErrStat( ErrID_Fatal, 'DBEMT requires the continuous formulation with constant tau1 for linearization. Set DBEMT_Mod=3 or set WakeMod to 0 or 1.', ErrStat, ErrMsg, RoutineName )
Expand Down
134 changes: 62 additions & 72 deletions modules/aerodyn/src/AeroDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,30 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade
call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, InputFileData%NumOuts, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;

!====== Legacy logic to match old and new input files ================================================
! NOTE: remove me in future release
if (frozenWakeProvided) then
if (InputFileData%FrozenWake) then
call WrScr(' FrozenWake=True -> Setting DBEMT_Mod=-1')
InputFileData%DBEMT_Mod = DBEMT_frozen
else
call WrScr(' FrozenWake=False -> Not changing DBEMT_Mod')
endif
endif
if (AFAeroModProvided) then
if (InputFileData%AFAeroMod==1) then
call WrScr(' AFAeroMod=1 -> Setting UAMod=0')
InputFileData%UAMod = UA_None
else if (InputFileData%AFAeroMod==2) then
call WrScr(' AFAeroMod=2 -> Not changing DBEMT_Mod')
if (InputFileData%UAMod==0) then
call LegacyAbort('Cannot set UAMod=0 with legacy option AFAeroMod=2 (inconsistent behavior).')
endif
else
call LegacyAbort('AFAeroMod should be 1 or 2'); return
endif
endif

!====== Nodal Outputs ==============================================================================
! In case there is something ill-formed in the additional nodal outputs section, we will simply ignore it.
! Expecting at least 5 more lines in the input file for this section
Expand Down Expand Up @@ -1048,28 +1072,6 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade
! Prevent segfault when no blades specified. All logic tests on BldNd_NumOuts at present.
if (InputFileData%BldNd_BladesOut <= 0) InputFileData%BldNd_NumOuts = 0


!====== Legacy logic to match old and new input files ================================================
! NOTE: remove me in future release
if (frozenWakeProvided) then
if (InputFileData%FrozenWake) then
call WrScr(' FrozenWake=True -> Setting DBEMT_Mod=-1')
InputFileData%DBEMT_Mod = DBEMT_frozen
else
call WrScr(' FrozenWake=False -> Not changing DBEMT_Mod')
endif
endif
if (AFAeroModProvided) then
if (InputFileData%AFAeroMod==1) then
call WrScr(' AFAeroMod=1 -> Setting UAMod=0')
! InputFileData%UAMod=0
else if (InputFileData%AFAeroMod==2) then
call WrScr(' AFAeroMod=2 -> Not changing DBEMT_Mod')
else
call LegacyAbort('AFAeroMod should be 1 or 2'); return
endif
endif

!====== Summary of new AeroDyn options ===============================================================
! NOTE: remove me in future release
call WrScr('-------------- New AeroDyn inputs (with new meaning):')
Expand Down Expand Up @@ -1162,9 +1164,9 @@ logical function legacyInputPresent(varName, iLine, errStat, errMsg, varNameSubs
legacyInputPresent = errStat == ErrID_None
if (legacyInputPresent) then
if (present(varNameSubs)) then
call LegacyWarning('Input '//trim(varName)//' has now been removed.'//NewLine//'Replaced by: '//trim(varNameSubs)//'.')
call LegacyWarning(trim(varName)//' has now been removed.'//NewLine//' Using: '//trim(varNameSubs)//'.')
else
call LegacyWarning('Input '//trim(varName)//' has now been removed.')
call LegacyWarning(trim(varName)//' has now been removed.')
endif
else
! We are actually happy, this input should indeed not be present.
Expand All @@ -1182,7 +1184,7 @@ logical function newInputAbsent(varName, iLine, errStat, errMsg, varNameSubs)
character(len=*), optional, intent(in ) :: varNameSubs !< Substituted variable
newInputAbsent = errStat == ErrID_Fatal
if (newInputAbsent) then
call LegacyWarning('Input '//trim(varName)//' should be present on line '//trim(num2lstr(iLine))//'.')
call LegacyWarning(trim(varName)//' should be present on line '//trim(num2lstr(iLine))//'.')
else
! We are happy
endif
Expand Down Expand Up @@ -1491,19 +1493,6 @@ SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg )
Msg = 'unknown'
end select
WRITE (UnSu,Ec_IntFrmt) p_AD%WakeMod, 'WakeMod', 'Type of wake/induction model: '//TRIM(Msg)


! AFAeroMod
select case (InputFileData%AFAeroMod)
case (AFAeroMod_BL_unsteady)
Msg = 'Beddoes-Leishman unsteady model'
case (AFAeroMod_steady)
Msg = 'steady'
case default
Msg = 'unknown'
end select
WRITE (UnSu,Ec_IntFrmt) InputFileData%AFAeroMod, 'AFAeroMod', 'Type of blade airfoil aerodynamics model: '//TRIM(Msg)


! TwrPotent
select case (p%TwrPotent)
Expand Down Expand Up @@ -1645,42 +1634,43 @@ SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg )

end if

if (InputFileData%AFAeroMod==AFAeroMod_BL_unsteady) then
WRITE (UnSu,'(A)') '====== Beddoes-Leishman Unsteady Airfoil Aerodynamics Options ====================================='

! UAMod
select case (InputFileData%UAMod)
case (UA_Baseline)
Msg = 'baseline model (original)'
case (UA_Gonzalez)
Msg = "Gonzalez's variant (changes in Cn, Cc, and Cm)"
case (UA_MinnemaPierce)
Msg = 'Minnema/Pierce variant (changes in Cc and Cm)'
!case (4)
! Msg = 'DYSTOOL'
case (UA_HGM)
Msg = 'HGM (continuous state)'
case (UA_HGMV)
Msg = 'HGMV (continuous state + vortex)'
case (UA_OYE)
Msg = 'Stieg Oye dynamic stall model'
case (UA_BV)
Msg = 'Boeing-Vertol dynamic stall model (e.g. used in CACTUS)'
case default
Msg = 'unknown'
end select
WRITE (UnSu,Ec_IntFrmt) InputFileData%UAMod, 'UAMod', 'Unsteady Aero Model: '//TRIM(Msg)

WRITE (UnSu,'(A)') '======================== Unsteady Airfoil Aerodynamics Options ====================================='

! FLookup
if (InputFileData%FLookup) then
Msg = 'Yes'
else
Msg = 'No, use best-fit exponential equations instead'
end if
WRITE (UnSu,Ec_LgFrmt) InputFileData%FLookup, 'FLookup', "Use a lookup for f'? "//TRIM(Msg)
! UAMod
select case (InputFileData%UAMod)
case (UA_None)
Msg = 'none (quasi-steady airfoil aerodynamics)'
case (UA_Baseline)
Msg = 'baseline model (original)'
case (UA_Gonzalez)
Msg = "Gonzalez's variant (changes in Cn, Cc, and Cm)"
case (UA_MinnemaPierce)
Msg = 'Minnema/Pierce variant (changes in Cc and Cm)'
!case (4)
! Msg = 'DYSTOOL'
case (UA_HGM)
Msg = 'HGM (continuous state)'
case (UA_HGMV)
Msg = 'HGMV (continuous state + vortex)'
case (UA_OYE)
Msg = 'Stieg Oye dynamic stall model'
case (UA_BV)
Msg = 'Boeing-Vertol dynamic stall model (e.g. used in CACTUS)'
case default
Msg = 'unknown'
end select
WRITE (UnSu,Ec_IntFrmt) InputFileData%UAMod, 'UAMod', 'Unsteady Aero Model: '//TRIM(Msg)


! FLookup
if (InputFileData%FLookup) then
Msg = 'Yes'
else
Msg = 'No, use best-fit exponential equations instead'
end if
WRITE (UnSu,Ec_LgFrmt) InputFileData%FLookup, 'FLookup', "Use a lookup for f'? "//TRIM(Msg)


end if

WRITE (UnSu,'(A)') '====== Outputs ===================================================================================='

Expand Down
3 changes: 0 additions & 3 deletions modules/aerodyn/src/AeroDyn_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ param ^ - IntKi WakeMod_BEMT - 1 - "Wake model
param ^ - IntKi WakeMod_DBEMT - 2 - "Wake model - DBEMT (dynamic elememnt momentum theory)" -
param ^ - IntKi WakeMod_FVW - 3 - "Wake model - FVW (free vortex wake, OLAF)" -

param ^ - IntKi AFAeroMod_steady - 1 - "steady model" -
param ^ - IntKi AFAeroMod_BL_unsteady - 2 - "Beddoes-Leishman unsteady model" -

param ^ - IntKi TwrPotent_none - 0 - "no tower potential flow" -
param ^ - IntKi TwrPotent_baseline - 1 - "baseline tower potential flow" -
param ^ - IntKi TwrPotent_Bak - 2 - "tower potential flow with Bak correction" -
Expand Down
2 changes: 0 additions & 2 deletions modules/aerodyn/src/AeroDyn_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ MODULE AeroDyn_Types
INTEGER(IntKi), PUBLIC, PARAMETER :: WakeMod_BEMT = 1 ! Wake model - BEMT (blade elememnt momentum theory) [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: WakeMod_DBEMT = 2 ! Wake model - DBEMT (dynamic elememnt momentum theory) [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: WakeMod_FVW = 3 ! Wake model - FVW (free vortex wake, OLAF) [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: AFAeroMod_steady = 1 ! steady model [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: AFAeroMod_BL_unsteady = 2 ! Beddoes-Leishman unsteady model [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: TwrPotent_none = 0 ! no tower potential flow [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: TwrPotent_baseline = 1 ! baseline tower potential flow [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: TwrPotent_Bak = 2 ! tower potential flow with Bak correction [-]
Expand Down
1 change: 1 addition & 0 deletions modules/aerodyn/src/UnsteadyAero_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ usefrom AirfoilInfo_Registry.txt
#
#

param UnsteadyAero/UA - INTEGER UA_None - 0 - "UAMod = 0 [Quasi-steady ]" -
param UnsteadyAero/UA - INTEGER UA_Baseline - 1 - "UAMod = 1 [Baseline model (Original)]" -
param UnsteadyAero/UA - INTEGER UA_Gonzalez - 2 - "UAMod = 2 [Gonzalez's variant (changes in Cn,Cc,Cm)]" -
param UnsteadyAero/UA - INTEGER UA_MinnemaPierce - 3 - "[Minnema/Pierce variant (changes in Cc and Cm)]" -
Expand Down
1 change: 1 addition & 0 deletions modules/aerodyn/src/UnsteadyAero_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MODULE UnsteadyAero_Types
USE AirfoilInfo_Types
USE NWTC_Library
IMPLICIT NONE
INTEGER(IntKi), PUBLIC, PARAMETER :: UA_None = 0 ! UAMod = 0 [Quasi-steady ] [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: UA_Baseline = 1 ! UAMod = 1 [Baseline model (Original)] [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: UA_Gonzalez = 2 ! UAMod = 2 [Gonzalez's variant (changes in Cn,Cc,Cm)] [-]
INTEGER(IntKi), PUBLIC, PARAMETER :: UA_MinnemaPierce = 3 ! [Minnema/Pierce variant (changes in Cc and Cm)] [-]
Expand Down

0 comments on commit 08edd1b

Please sign in to comment.