From 13d31fdec57f82bbd29c229d5c40008279148715 Mon Sep 17 00:00:00 2001 From: Emmanuel Branlard Date: Tue, 7 May 2024 19:49:35 -0400 Subject: [PATCH] AD: switching to UA_Mod, removing 10, 11, 12 hack --- modules/aerodyn/src/AeroDyn.f90 | 42 +++++------------------- modules/aerodyn/src/AeroDyn_IO.f90 | 14 ++++---- modules/aerodyn/src/AeroDyn_Registry.txt | 2 +- modules/aerodyn/src/AeroDyn_Types.f90 | 8 ++--- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/modules/aerodyn/src/AeroDyn.f90 b/modules/aerodyn/src/AeroDyn.f90 index 6624bcd18..83fd79f25 100644 --- a/modules/aerodyn/src/AeroDyn.f90 +++ b/modules/aerodyn/src/AeroDyn.f90 @@ -318,32 +318,6 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut CALL ParsePrimaryFileInfo( PriPath, InitInp, InitInp%InputFile, p%RootName, NumBlades, interval, FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) if (Failed()) return; - ! Temporary HACK, for WakeMod=10, 11 or 12 use AeroProjMod 2 (will trigger PolarBEM) - if (InputFileData%Wake_Mod==10) then - call WrScr('[WARN] Wake_Mod=10 is a temporary hack. Using new projection method with Wake_Mod=0 and DBEMT_Mod=0') - if (InputFileData%DBEMT_Mod/=0) then - call Fatal('DBEMT_Mod should be =0 when using the temporary hack Wake_Mod=10.'); return - endif - InputFileData%Wake_Mod = 0 - AeroProjMod(:) = APM_BEM_Polar - - elseif (InputFileData%Wake_Mod==11) then - call WrScr('[WARN] Wake_Mod=11 is a temporary hack. Using new projection method with Wake_Mod=1 (BEM) and DBEMT_Mod=0.') - if (InputFileData%DBEMT_Mod/=0) then - call Fatal('DBEMT_Mod should be 0 when using the temporary hack Wake_Mod=11.'); return - endif - InputFileData%Wake_Mod = 1 - AeroProjMod(:) = APM_BEM_Polar - - elseif (InputFileData%Wake_Mod==12) then - call WrScr('[WARN] Wake_Mod=12 is a temporary hack. Using new projection method with Wake_Mod=1 (BEM) and DBEMT_Mod>=1.') - if (InputFileData%DBEMT_Mod<1) then - call Fatal('DBEMT_Mod should be >=1 when using the temporary hack Wake_Mod=12.'); return - endif - InputFileData%Wake_Mod = 1 - AeroProjMod(:) = APM_BEM_Polar - endif - ! --- "Automatic handling of AeroProjMod do iR = 1, nRotors if (AeroProjMod(iR) == -1) then @@ -371,7 +345,7 @@ 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" - InputFileData%UAMod = UA_None + InputFileData%UA_Mod = UA_None InputFileData%TwrPotent = TwrPotent_none InputFileData%TwrShadow = TwrShadow_none InputFileData%TwrAero = .false. @@ -1362,7 +1336,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%UAMod > UA_None + p_AD%UA_Flag = InputFileData%UA_Mod > UA_None p_AD%CompAeroMaps = InitInp%CompAeroMaps p_AD%SectAvg = InputFileData%SectAvg @@ -3932,7 +3906,7 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) end if !BEMT/DBEMT checks - if ( InputFileData%CavitCheck .and. InputFileData%UAMod >0) then + if ( InputFileData%CavitCheck .and. InputFileData%UA_Mod >0) then call SetErrStat( ErrID_Fatal, 'Cannot use unsteady aerodynamics module with a cavitation check', ErrStat, ErrMsg, RoutineName ) end if @@ -4138,8 +4112,8 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) call SetErrStat( ErrID_Fatal, 'WakeMod must be 0 or 1 for linearization.', ErrStat, ErrMsg, RoutineName ) endif - 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 ) + if (InputFileData%UA_Mod /= UA_None .and. InputFileData%UA_Mod /= UA_HGM .and. InputFileData%UA_Mod /= UA_HGMV .and. InputFileData%UA_Mod /= UA_OYE) then + call SetErrStat( ErrID_Fatal, 'UA_Mod must be 0, 4, 5, or 6 for linearization.', ErrStat, ErrMsg, RoutineName ) end if if (InputFileData%DBEMT_Mod /= DBEMT_None .and. InputFileData%DBEMT_Mod /= DBEMT_cont_tauConst) then @@ -4200,7 +4174,7 @@ SUBROUTINE Init_AFIparams( InputFileData, p_AFI, UnEc, ErrStat, ErrMsg ) IF (.not. InputFileData%UseBlCm) AFI_InitInputs%InCol_Cm = 0 ! Don't try to use Cm if flag set to false AFI_InitInputs%InCol_Cpmin = InputFileData%InCol_Cpmin AFI_InitInputs%AFTabMod = InputFileData%AFTabMod !AFITable_1 - AFI_InitInputs%UA_f_cn = (InputFileData%UAMod /= UA_HGM).and.(InputFileData%UAMod /= UA_OYE) ! HGM and OYE use the separation function based on cl instead of cn + AFI_InitInputs%UA_f_cn = (InputFileData%UA_Mod /= UA_HGM).and.(InputFileData%UA_Mod /= UA_OYE) ! HGM and OYE use the separation function based on cl instead of cn ! Call AFI_Init to read in and process the airfoil files. ! This includes creating the spline coefficients to be used for interpolation. @@ -4490,7 +4464,7 @@ SUBROUTINE Init_BEMTmodule( InputFileData, RotInputFileData, u_AD, u, p, p_AD, x end do InitInp%UA_Flag = p_AD%UA_Flag - InitInp%UAMod = InputFileData%UAMod + InitInp%UAMod = InputFileData%UA_Mod InitInp%Flookup = InputFileData%Flookup InitInp%a_s = InputFileData%SpdSound InitInp%SumPrint = InputFileData%SumPrint @@ -4687,7 +4661,7 @@ SUBROUTINE Init_OLAF( InputFileData, u_AD, u, p, x, xd, z, OtherState, m, ErrSta ! Unsteady Aero Data InitInp%UA_Flag = p%UA_Flag - InitInp%UAMod = InputFileData%UAMod + InitInp%UAMod = InputFileData%UA_Mod InitInp%Flookup = InputFileData%Flookup InitInp%a_s = InputFileData%SpdSound InitInp%SumPrint = InputFileData%SumPrint diff --git a/modules/aerodyn/src/AeroDyn_IO.f90 b/modules/aerodyn/src/AeroDyn_IO.f90 index 6966432ad..36926fa62 100644 --- a/modules/aerodyn/src/AeroDyn_IO.f90 +++ b/modules/aerodyn/src/AeroDyn_IO.f90 @@ -894,10 +894,10 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade call ParseVar( FileInfo_In, CurLine, "UAMod", UAMod_Old, ErrStat2, ErrMsg2, UnEc ) UAModProvided = legacyInputPresent('UAMod', CurLine, ErrStat2, ErrMsg2, 'UA_Mod=0 (AFAeroMod=1), UA_Mod>1 (AFAeroMod=2 and UA_Mod=UAMod') ! UA_Mod - Unsteady Aero Model Switch (switch) {0=Quasi-steady (no UA), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)} - call ParseVar( FileInfo_In, CurLine, "UA_Mod", InputFileData%UAMod, ErrStat2, ErrMsg2, UnEc ) + call ParseVar( FileInfo_In, CurLine, "UA_Mod", InputFileData%UA_Mod, ErrStat2, ErrMsg2, UnEc ) if (newInputMissing('UA_Mod', CurLine, errStat2, errMsg2)) then ! We'll deal with it when we deal with AFAeroMod - InputFileData%UAMod = UAMod_Old + InputFileData%UA_Mod = UAMod_Old if (.not. UAModProvided) then call LegacyAbort('Need to provide either UA_Mod or UAMod in the input file'); return endif @@ -1110,14 +1110,14 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade if (AFAeroModProvided) then if (AFAeroMod_Old==1) then call WrScr('> AFAeroMod=1 -> Setting UA_Mod=0') - InputFileData%UAMod = UA_None + InputFileData%UA_Mod = UA_None if (AoA34_Missing) then call WrScr('> Setting AoA34 to False as the input is Missing and UA is turned off (legacy behavior).') InputFileData%AoA34=.false. endif else if (AFAeroMod_Old==2) then call WrScr('> AFAeroMod=2 -> Not changing DBEMT_Mod') - if (InputFileData%UAMod==0) then + if (InputFileData%UA_Mod==0) then call LegacyAbort('Cannot set UA_Mod=0 with legacy option AFAeroMod=2 (inconsistent behavior).'); return else if (AoA34_Missing) then call WrScr('> Setting AoA34 to True as the input is Missing and UA is turned on (legacy behavior).') @@ -1308,7 +1308,7 @@ subroutine printNewOldInputs() write (tmpStr,'(A20,L1)') 'SkewMomCorr:' , InputFileData%SkewMomCorr; call WrScr(trim(tmpStr)) write (tmpStr,'(A20,I0)') 'SkewRedistr_Mod:' , InputFileData%SkewRedistr_Mod; call WrScr(trim(tmpStr)) write (tmpStr,'(A20,L1)') 'AoA34: ' , InputFileData%AoA34; call WrScr(trim(tmpStr)) - write (tmpStr,'(A20,I0)') 'UA_Mod: ' , InputFileData%UAMod; call WrScr(trim(tmpStr)) + write (tmpStr,'(A20,I0)') 'UA_Mod: ' , InputFileData%UA_Mod; call WrScr(trim(tmpStr)) call WrScr('-------------- Old AeroDyn inputs:') write (tmpStr,'(A20,I0)') 'WakeMod: ', WakeMod_Old; call WrScr(trim(tmpStr)) write (tmpStr,'(A20,I0)') 'SkewMod: ', SkewMod_Old; call WrScr(trim(tmpStr)) @@ -1768,7 +1768,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg ) WRITE (UnSu,'(A)') '======================== Unsteady Airfoil Aerodynamics Options =====================================' ! UAMod - select case (InputFileData%UAMod) + select case (InputFileData%UA_Mod) case (UA_None) Msg = 'none (quasi-steady airfoil aerodynamics)' case (UA_Baseline) @@ -1790,7 +1790,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg ) case default Msg = 'unknown' end select - WRITE (UnSu,Ec_IntFrmt) InputFileData%UAMod, 'UAMod', 'Unsteady Aero Model: '//TRIM(Msg) + WRITE (UnSu,Ec_IntFrmt) InputFileData%UA_Mod, 'UA_Mod', 'Unsteady Aero Model: '//TRIM(Msg) ! FLookup diff --git a/modules/aerodyn/src/AeroDyn_Registry.txt b/modules/aerodyn/src/AeroDyn_Registry.txt index 200beb345..4161e04e2 100644 --- a/modules/aerodyn/src/AeroDyn_Registry.txt +++ b/modules/aerodyn/src/AeroDyn_Registry.txt @@ -207,7 +207,7 @@ typedef ^ ^ ReKi SA_PsiBwd - -60 - "Sector Average - Backard Azimu typedef ^ ^ ReKi SA_PsiFwd - 60 - "Sector Average - Forward Azimuth (>0)" deg typedef ^ ^ IntKi SA_nPerSec - 5 - "Sector average - Number of points per sectors (-) [used only when SectAvg=True]" - typedef ^ ^ LOGICAL AoA34 - - - "Sample the angle of attack (AoA) at the 3/4 chord or the AC point {default=True} [always used]" - -typedef ^ ^ IntKi UAMod - - - "Unsteady Aero Model Switch (switch) {0=Quasi-steady (no UA), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)}" - +typedef ^ ^ IntKi UA_Mod - - - "Unsteady Aero Model Switch (switch) {0=Quasi-steady (no UA), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)}" - typedef ^ AD_InputFile LOGICAL FLookup - - - "Flag to indicate whether a lookup for f' will be calculated (TRUE) or whether best-fit exponential equations will be used (FALSE); if FALSE S1-S4 must be provided in airfoil input files [used only when AFAeroMod=2]" flag typedef ^ AD_InputFile ReKi InCol_Alfa - - - "The column in the airfoil tables that contains the angle of attack" - typedef ^ AD_InputFile ReKi InCol_Cl - - - "The column in the airfoil tables that contains the lift coefficient" - diff --git a/modules/aerodyn/src/AeroDyn_Types.f90 b/modules/aerodyn/src/AeroDyn_Types.f90 index 8bcf87651..407e4bca2 100644 --- a/modules/aerodyn/src/AeroDyn_Types.f90 +++ b/modules/aerodyn/src/AeroDyn_Types.f90 @@ -233,7 +233,7 @@ MODULE AeroDyn_Types REAL(ReKi) :: SA_PsiFwd = 60 !< Sector Average - Forward Azimuth (>0) [deg] INTEGER(IntKi) :: SA_nPerSec = 5 !< Sector average - Number of points per sectors (-) [used only when SectAvg=True] [-] LOGICAL :: AoA34 = .false. !< Sample the angle of attack (AoA) at the 3/4 chord or the AC point {default=True} [always used] [-] - INTEGER(IntKi) :: UAMod = 0_IntKi !< Unsteady Aero Model Switch (switch) {0=Quasi-steady (no UA), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)} [-] + INTEGER(IntKi) :: UA_Mod = 0_IntKi !< Unsteady Aero Model Switch (switch) {0=Quasi-steady (no UA), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)} [-] LOGICAL :: FLookup = .false. !< Flag to indicate whether a lookup for f' will be calculated (TRUE) or whether best-fit exponential equations will be used (FALSE); if FALSE S1-S4 must be provided in airfoil input files [used only when AFAeroMod=2] [flag] REAL(ReKi) :: InCol_Alfa = 0.0_ReKi !< The column in the airfoil tables that contains the angle of attack [-] REAL(ReKi) :: InCol_Cl = 0.0_ReKi !< The column in the airfoil tables that contains the lift coefficient [-] @@ -2062,7 +2062,7 @@ subroutine AD_CopyInputFile(SrcInputFileData, DstInputFileData, CtrlCode, ErrSta DstInputFileData%SA_PsiFwd = SrcInputFileData%SA_PsiFwd DstInputFileData%SA_nPerSec = SrcInputFileData%SA_nPerSec DstInputFileData%AoA34 = SrcInputFileData%AoA34 - DstInputFileData%UAMod = SrcInputFileData%UAMod + DstInputFileData%UA_Mod = SrcInputFileData%UA_Mod DstInputFileData%FLookup = SrcInputFileData%FLookup DstInputFileData%InCol_Alfa = SrcInputFileData%InCol_Alfa DstInputFileData%InCol_Cl = SrcInputFileData%InCol_Cl @@ -2215,7 +2215,7 @@ subroutine AD_PackInputFile(RF, Indata) call RegPack(RF, InData%SA_PsiFwd) call RegPack(RF, InData%SA_nPerSec) call RegPack(RF, InData%AoA34) - call RegPack(RF, InData%UAMod) + call RegPack(RF, InData%UA_Mod) call RegPack(RF, InData%FLookup) call RegPack(RF, InData%InCol_Alfa) call RegPack(RF, InData%InCol_Cl) @@ -2297,7 +2297,7 @@ subroutine AD_UnPackInputFile(RF, OutData) call RegUnpack(RF, OutData%SA_PsiFwd); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%SA_nPerSec); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%AoA34); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%UAMod); if (RegCheckErr(RF, RoutineName)) return + call RegUnpack(RF, OutData%UA_Mod); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%FLookup); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%InCol_Alfa); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%InCol_Cl); if (RegCheckErr(RF, RoutineName)) return