From 00d469986446a465025e24033bee9b1f25307d1c Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Thu, 6 Aug 2026 17:11:21 -0600 Subject: [PATCH] Fix #3421: Guard DT_mooring validation with mooring enabled check - Wrap DT_mooring validation in 'if (p%MooringMod == 3)' conditional - Add file existence check for MD_FileName when mooring is enabled - Prevents fatal error when Mod_SharedMooring=0 and mooring is not used - Follows established OpenFAST pattern for module-specific validations Co-authored-by: GitHub Copilot Co-authored-by: Claude Sonnet 4.5 --- glue-codes/fast-farm/src/FAST_Farm_IO.f90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/glue-codes/fast-farm/src/FAST_Farm_IO.f90 b/glue-codes/fast-farm/src/FAST_Farm_IO.f90 index 32fce6d53c..d954a4ea39 100644 --- a/glue-codes/fast-farm/src/FAST_Farm_IO.f90 +++ b/glue-codes/fast-farm/src/FAST_Farm_IO.f90 @@ -1047,6 +1047,7 @@ SUBROUTINE Farm_ValidateInput( p, WD_InitInp, AWAE_InitInp, ErrStat, ErrMsg ) CHARACTER(*), PARAMETER :: RoutineName = 'Farm_ValidateInput' INTEGER(IntKi) :: n_disDT_dt character(60) :: tmpStr + logical :: file_exists ! Flag for file existence check ErrStat = ErrID_None ErrMsg = "" @@ -1066,8 +1067,11 @@ SUBROUTINE Farm_ValidateInput( p, WD_InitInp, AWAE_InitInp, ErrStat, ErrMsg ) ! TODO : Verify that the DLL file exists ! --- SHARED MOORING SYSTEM --- - ! TODO : Verify that p%MD_FileName file exists - if ((p%DT_mooring <= 0.0_ReKi) .or. (p%DT_mooring > p%DT_high)) CALL SetErrStat(ErrID_Fatal,'DT_mooring must be greater than zero and no greater than dt_high.',ErrStat,ErrMsg,RoutineName) + if (p%MooringMod == 3) then + inquire(file=trim(p%MD_FileName), exist=file_exists) + if (.not. file_exists) call SetErrStat(ErrID_Fatal,'Cannot find MoorDyn input file '//trim(p%MD_FileName),ErrStat,ErrMsg,RoutineName) + if ((p%DT_mooring <= 0.0_ReKi) .or. (p%DT_mooring > p%DT_high)) CALL SetErrStat(ErrID_Fatal,'DT_mooring must be greater than zero and no greater than dt_high.',ErrStat,ErrMsg,RoutineName) + end if ! --- AMBIENT WIND: INFLOWWIND MODULE --- [used only for Mod_AmbWind=2 or 3] --- ! FIXME: this really should be checked with the turbine specific size diameter -- maybe relocate this check to AWAE or in FF after initializing all turbines?