Skip to content

Fix #3421: Guard DT_mooring validation with mooring enabled check - #3422

Open
andrew-platt wants to merge 1 commit into
OpenFAST:rc-5.0.1from
andrew-platt:b/FF_DT_mooring_check
Open

Fix #3421: Guard DT_mooring validation with mooring enabled check#3422
andrew-platt wants to merge 1 commit into
OpenFAST:rc-5.0.1from
andrew-platt:b/FF_DT_mooring_check

Conversation

@andrew-platt

Copy link
Copy Markdown
Collaborator

Ready to merge

Feature or improvement description

This PR fixes a bug in FAST.Farm where DT_mooring validation was incorrectly executed regardless of whether shared mooring was enabled, causing fatal errors for users running cases with Mod_SharedMooring = 0.

The fix adds conditional guards around mooring-related validations so they only execute when mooring is actually enabled (Mod_SharedMooring = 3). Additionally, this implements the TODO for verifying that the MoorDyn input file exists.

Changes made:

  • Wrapped DT_mooring validation in if (p%MooringMod == 3) conditional
  • Added file existence check for MD_FileName when mooring is enabled
  • Added file_exists logical variable declaration to support the validation

Before:

! --- 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)

After:

! --- SHARED MOORING SYSTEM ---
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

Related issue, if one exists

Fixes #3421

Impacted areas of the software

  • FAST.Farm input file validation (glue-codes/fast-farm/src/FAST_Farm_IO.f90)
  • Specifically the Farm_ValidateInput() subroutine

Additional supporting information

The implementation follows established OpenFAST patterns:

  • Module-specific conditional validation (similar to CompMooring checks in FAST_Subs.f90)
  • File existence checks (similar to pattern in WaveTank_IO.f90)

This is a non-breaking change that:

  • ✅ Allows cases with Mod_SharedMooring = 0 to run without spurious DT_mooring validation errors
  • ✅ Maintains strict validation when mooring is enabled (Mod_SharedMooring = 3)
  • ✅ Adds better error reporting for missing MoorDyn input files

Generative AI usage

Co-authored-by: GitHub Copilot noreply@github.com
Co-authored-by: Claude Sonnet 4.5 noreply@anthropic.com

Test results, if applicable

  • r-test branch merging required

No r-test changes needed. This is a validation-only fix that:

  1. Removes false-positive errors when mooring is disabled
  2. Adds file existence validation when mooring is enabled

Existing regression tests with mooring enabled should continue to pass. Cases with Mod_SharedMooring = 0 will no longer fail validation unnecessarily.

…heck

- 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 <noreply@github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@andrew-platt andrew-platt added this to the v5.0.1 milestone Aug 6, 2026
@andrew-platt
andrew-platt requested a review from rthedin August 6, 2026 23:15
@andrew-platt andrew-platt self-assigned this Aug 6, 2026
@andrew-platt andrew-platt linked an issue Aug 6, 2026 that may be closed by this pull request

@rthedin rthedin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FF: DT_Mooring restrictions even with moorings off

2 participants