Skip to content

Commit

Permalink
Fix logic error in AirDens handling in FAST_Subs
Browse files Browse the repository at this point in the history
ExtInfw was incorrectly receiving a 0 for the air density due to a logic error introduced when ExtInfw_Init was relocated to after AeroDyn

Also add AirDens initialization output from AeroDisk (this gets passed to ServoDyn)
  • Loading branch information
andrew-platt committed Oct 23, 2024
1 parent 5163c74 commit 7e20470
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modules/aerodisk/src/AeroDisk.f90
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ subroutine Init_InitY(ErrStat3,ErrMsg3)
InitOut%WriteOutputUnt(i) = p%OutParam(i)%Units
end do
! Version
InitOut%Ver = ADsk_Ver
InitOut%Ver = ADsk_Ver
InitOut%AirDens = p%AirDens
end subroutine Init_InitY
END SUBROUTINE ADsk_Init

Expand Down
1 change: 1 addition & 0 deletions modules/aerodisk/src/AeroDisk_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef ^ InitInputType FlowFieldType *FlowField - -
typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" -
typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" -
typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" -
typedef ^ InitOutputType ReKi AirDens - - - "Air density" "kg/m^3"


# ..... Inputs ....................................................................................................................
Expand Down
4 changes: 4 additions & 0 deletions modules/aerodisk/src/AeroDisk_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ MODULE AeroDisk_Types
CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputHdr !< Names of the output-to-file channels [-]
CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputUnt !< Units of the output-to-file channels [-]
TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-]
REAL(ReKi) :: AirDens = 0.0_ReKi !< Air density [kg/m^3]
END TYPE ADsk_InitOutputType
! =======================
! ========= ADsk_InputType =======
Expand Down Expand Up @@ -634,6 +635,7 @@ subroutine ADsk_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, E
call NWTC_Library_CopyProgDesc(SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
DstInitOutputData%AirDens = SrcInitOutputData%AirDens
end subroutine

subroutine ADsk_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg)
Expand Down Expand Up @@ -663,6 +665,7 @@ subroutine ADsk_PackInitOutput(RF, Indata)
call RegPackAlloc(RF, InData%WriteOutputHdr)
call RegPackAlloc(RF, InData%WriteOutputUnt)
call NWTC_Library_PackProgDesc(RF, InData%Ver)
call RegPack(RF, InData%AirDens)
if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand All @@ -677,6 +680,7 @@ subroutine ADsk_UnPackInitOutput(RF, OutData)
call RegUnpackAlloc(RF, OutData%WriteOutputHdr); if (RegCheckErr(RF, RoutineName)) return
call RegUnpackAlloc(RF, OutData%WriteOutputUnt); if (RegCheckErr(RF, RoutineName)) return
call NWTC_Library_UnpackProgDesc(RF, OutData%Ver) ! Ver
call RegUnpack(RF, OutData%AirDens); if (RegCheckErr(RF, RoutineName)) return
end subroutine

subroutine ADsk_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg)
Expand Down
8 changes: 6 additions & 2 deletions modules/openfast-library/src/FAST_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S
RETURN
END IF

! AeroDyn may override the AirDens value. Store this to inform other modules
AirDens = Init%OutData_AD%rotors(1)%AirDens

ELSEIF ( p_FAST%CompAero == Module_ADsk ) THEN
Expand Down Expand Up @@ -795,6 +796,9 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S
CALL SetModuleSubstepTime(Module_ADsk, p_FAST, y_FAST, ErrStat2, ErrMsg2)
CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)

! AeroDisk may override the AirDens value. Store this to inform other modules
AirDens = Init%OutData_ADsk%AirDens

END IF ! CompAero

IF ( p_FAST%CompAero == Module_ExtLd ) THEN
Expand All @@ -815,6 +819,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S
RETURN
END IF

! ExtLd may override the AirDens value. Store this to inform other modules
AirDens = Init%OutData_ExtLd%AirDens

END IF
Expand All @@ -824,8 +829,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S
! ........................
! No aero of any sort
! ........................
IF ( (p_FAST%CompAero /= Module_AD) .and. (p_FAST%CompAero /= Module_ExtLd) ) THEN
ELSE
IF ( (p_FAST%CompAero == Module_None) .or. (p_FAST%CompAero == Module_ExtInfw)) THEN
AirDens = 0.0_ReKi
ENDIF

Expand Down

0 comments on commit 7e20470

Please sign in to comment.