Skip to content

Commit

Permalink
Merge pull request #716 from bjonkman/b/MinorBugs
Browse files Browse the repository at this point in the history
[BugFix] Fix C++ API for restart, Error handling in FAST Library, and AeroDyn echo file lock
  • Loading branch information
rafmudaf committed Aug 5, 2021
2 parents 216d498 + 6669716 commit fa26196
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ vs-build/
*.aux
*.nlo
*.log

#Simulink cache files
varcache
*.slxc

2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5246,7 +5246,7 @@ SUBROUTINE Init_Jacobian_u( InputFileData, p, u, InitOut, ErrStat, ErrMsg)

do k=1,p%NumBlades
do i=1,p%NumBlNds
InitOut%LinNames_u(index) = 'User property on blade '//trim(num2lstr(k))//', node '//trim(num2lstr(i))//', -'
InitOut%LinNames_u(index) = 'User property on blade '//trim(num2lstr(k))//', node '//trim(num2lstr(i))//', -'
index = index + 1
end do
end do
Expand Down
14 changes: 6 additions & 8 deletions modules/aerodyn/src/AeroDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ SUBROUTINE ReadInputFiles( InputFileName, InputFileData, Default_DT, OutFileRoot
CHARACTER(*), INTENT(IN) :: OutFileRoot ! The rootname of all the output files written by this routine.

TYPE(AD_InputFile), INTENT(INOUT) :: InputFileData ! Data stored in the module's input file
INTEGER(IntKi), INTENT(OUT) :: UnEcho ! Unit number for the echo file
INTEGER(IntKi), INTENT(INOUT) :: UnEcho ! Unit number for the echo file

INTEGER(IntKi), INTENT(IN) :: NumBlades(:) ! Number of blades per rotor
INTEGER(IntKi), INTENT(OUT) :: ErrStat ! The error status code
Expand All @@ -1964,7 +1964,6 @@ SUBROUTINE ReadInputFiles( InputFileName, InputFileData, Default_DT, OutFileRoot

ErrStat = ErrID_None
ErrMsg = ''
UnEcho = -1
InputFileData%DTAero = Default_DT ! the glue code's suggested DT for the module (may be overwritten in ReadPrimaryFile())


Expand Down Expand Up @@ -2351,18 +2350,17 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv
logical function Failed()
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'ParsePrimaryFileInfo' )
Failed = ErrStat >= AbortErrLev
if (Failed) then
if (UnEc > -1_IntKi) CLOSE( UnEc )
endif
!if (Failed) then
!endif
end function Failed
logical function FailedNodal()
ErrMsg_NoAllBldNdOuts='AD15 Nodal Outputs: Nodal output section of AeroDyn input file not found or improperly formatted. Skipping nodal outputs.'
if (ErrStat2 >= AbortErrLev ) then
FailedNodal = ErrStat2 >= AbortErrLev
if ( FailedNodal ) then
InputFileData%BldNd_BladesOut = 0
InputFileData%BldNd_NumOuts = 0
call wrscr( trim(ErrMsg_NoAllBldNdOuts) )
endif
FailedNodal = ErrStat2 >= AbortErrLev
end function FailedNodal
!-------------------------------------------------------------------------------------------------
END SUBROUTINE ParsePrimaryFileInfo
Expand Down Expand Up @@ -2658,7 +2656,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg )
else
Msg = 'No'
end if
WRITE (UnSu,Ec_LgFrmt) InputFileData%AIDrag, 'AIDrag', "Include the drag term in the tangential-induction calculation? "//TRIM(Msg)
WRITE (UnSu,Ec_LgFrmt) InputFileData%TIDrag, 'TIDrag', "Include the drag term in the tangential-induction calculation? "//TRIM(Msg)

! IndToler
WRITE (UnSu,Ec_ReFrmt) InputFileData%IndToler, 'IndToler', "Convergence tolerance for BEM induction factors (radians)"
Expand Down
4 changes: 4 additions & 0 deletions modules/aerodyn/src/FVW.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,10 @@ subroutine WriteVTKOutputs(t, force, u, p, x, z, y, m, ErrStat, ErrMsg)
character(*), parameter :: RoutineName = 'FVW_CalcOutput'
integer(IntKi) :: iW, iGrid
integer(IntKi) :: nSeg, nSegP

ErrStat = ErrID_None
ErrMsg = ""

if (p%WrVTK>0) then
if (m%FirstCall .or. force) then
call MKDIR(p%VTK_OutFileRoot)
Expand Down
2 changes: 1 addition & 1 deletion modules/inflowwind/src/IfW_FFWind_Base.f90
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ FUNCTION FFWind_Interp(Time, Position, p, ErrStat, ErrMsg)

IF (p%InterpTower) THEN

CALL GetInterpValues()
CALL GetInterpValues(); if (ErrStat >= AbortErrLev) return

!-------------------------------------------------------------------------------------------------
! Interpolate on the bottom of the grid to the ground
Expand Down
4 changes: 2 additions & 2 deletions modules/openfast-library/src/FAST_Library.f90
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ subroutine FAST_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, NumOuts_c, d
! transfer Fortran variables to C:
n_t_global_c = n_t_global
AbortErrLev_c = AbortErrLev
NumOuts_c = min(MAXOUTPUTS, 1 + SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time
NumOuts_c = min(MAXOUTPUTS, SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time
dt_c = Turbine(iTurb)%p_FAST%dt

ErrStat_c = ErrStat
Expand Down Expand Up @@ -655,7 +655,7 @@ subroutine FAST_OpFM_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, n
! transfer Fortran variables to C:
n_t_global_c = n_t_global
AbortErrLev_c = AbortErrLev
NumOuts_c = min(MAXOUTPUTS, 1 + SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time
NumOuts_c = min(MAXOUTPUTS, SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time
if (allocated(Turbine(iTurb)%ad%p%rotors)) then ! this might not be allocated if we had an error earlier
numBlades_c = Turbine(iTurb)%ad%p%rotors(1)%numblades
numElementsPerBlade_c = Turbine(iTurb)%ad%p%rotors(1)%numblnds ! I'm not sure if FASTv8 can handle different number of blade nodes for each blade.
Expand Down
6 changes: 3 additions & 3 deletions modules/openfast-library/src/FAST_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD,
END IF

ELSEIF ( p_FAST%CompAero == Module_AD ) THEN

allocate(Init%InData_AD%rotors(1), stat=errStat)
if (errStat/=0) then
allocate(Init%InData_AD%rotors(1), stat=ErrStat2)
if (ErrStat2 /= 0 ) then
call SetErrStat( ErrID_Fatal, 'Allocating rotors', errStat, errMsg, RoutineName )
call Cleanup()
return
Expand Down
12 changes: 6 additions & 6 deletions vs-build/FAST-farm/FAST-Farm.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|Win32" OutputDirectory="..\..\build\bin\" TargetName="FAST.Farm_$(PlatformName)" WholeProgramOptimization="true">
Expand All @@ -21,7 +21,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Debug|x64" OutputDirectory="..\..\build\bin\" TargetName="FAST.Farm_$(PlatformName)_Debug">
Expand All @@ -31,7 +31,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|x64" OutputDirectory="..\..\build\bin\" TargetName="FAST.Farm_$(PlatformName)" WholeProgramOptimization="true">
Expand All @@ -41,7 +41,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_OpenMP|Win32" OutputDirectory="..\..\build\bin\" TargetName="FAST.Farm_$(PlatformName)_OMP">
Expand All @@ -51,7 +51,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_OpenMP|x64" OutputDirectory="..\..\build\bin\" TargetName="FAST.Farm_$(PlatformName)_OMP">
Expand All @@ -61,7 +61,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
Expand Down
16 changes: 8 additions & 8 deletions vs-build/FAST/FAST.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|Win32" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)" WholeProgramOptimization="true">
Expand All @@ -21,7 +21,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Debug|x64" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)_Debug">
Expand All @@ -31,7 +31,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|x64" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)" WholeProgramOptimization="true">
Expand All @@ -41,7 +41,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_Double|Win32" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)_Double" WholeProgramOptimization="true">
Expand All @@ -51,7 +51,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_Double|x64" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)_Double" WholeProgramOptimization="true">
Expand All @@ -61,7 +61,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Debug_Double|Win32" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)_Debug_Double">
Expand All @@ -71,7 +71,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Debug_Double|x64" OutputDirectory="..\..\build\bin\" TargetName="openfast_$(PlatformName)_Debug_Double">
Expand All @@ -81,7 +81,7 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="..\CreateGitVersion.bat"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
Expand Down
2 changes: 1 addition & 1 deletion vs-build/FASTlib/FASTlib.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Tool Name="VFLibrarianTool" AdditionalDependencies="$(OutDir)\MAP_$(PlatformName).lib"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool" AdditionalDependencies="terdf"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool" CommandLine="call ..\CreateGitVersion.bat"/>
<Tool Name="VFPostBuildEventTool"/></Configuration>
Expand Down
2 changes: 1 addition & 1 deletion vs-build/OpenFAST-Simulink/OpenFAST-Simulink.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_Matlab|x64" OutputDirectory="..\..\build\bin\" TargetName="$(ProjectName)_$(PlatformName)" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Preprocess="preprocessYes" PreprocessorDefinitions="COMPILE_SIMULINK" StandardWarnings="standardWarningsF03" DisableSpecificDiagnostics="5268,5199"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;C:\Program Files\MATLAB\R2018a\extern\lib\win64\microsoft\libmex.lib&quot;"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;C:\Program Files\MATLAB\R2019b\extern\lib\win64\microsoft\libmex.lib&quot;"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
Expand Down
1 change: 1 addition & 0 deletions vs-build/RunRegistry.bat
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ SET ModuleName=
SET CURR_LOC=

SET Root_Loc=
SET Output_Loc=

SET Subs_Loc=
SET FAST_Loc=
Expand Down

0 comments on commit fa26196

Please sign in to comment.