Skip to content

Move FAST.Farm K-d tree logic into AWAE_UpdateStates#3112

Merged
deslaughter merged 4 commits intoOpenFAST:dev-tcfrom
deslaughter:mv_ff_kdtree
Dec 23, 2025
Merged

Move FAST.Farm K-d tree logic into AWAE_UpdateStates#3112
deslaughter merged 4 commits intoOpenFAST:dev-tcfrom
deslaughter:mv_ff_kdtree

Conversation

@deslaughter
Copy link
Collaborator

This PR is ready to merge

Feature or improvement description

This PR moves the new K-d tree logic from AWAE_CalcOutput to AWAE_UpdateStates so that it is only calculated once, when updating the ambient wind. This will make it possible to selectively read the AMReX wind files for parts of the low-resolution grid without recalculating which grid partitions to read in multiple places.

This required a change in where AWAE_UpdateStates was called, moving it from FARM_UpdateStates to FARM_CalcOuput. In this process an error was discovered in the initial call to AWAE_UpdateStates, during AWAE_Init, where the wrong time was passed, resulting in the same wind velocities being used for the first two low-res time steps when the ambient wind was modeled in InflowWind. This PR fixes the issue and updates the FAST.FARM regression tests.

Impacted areas of the software

FAST.Farm and AWAE

Test results, if applicable

FAST.Farm regression test benchmarks were updated after the bug in AWAE_Init was fixed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors FAST.Farm's wake modeling workflow by moving K-d tree calculations from AWAE_CalcOutput to AWAE_UpdateStates, ensuring wake-grid interactions are computed only once per ambient wind update. A critical bug was also fixed where AWAE_Init passed an incorrect time value, causing duplicate wind velocities for the first two low-resolution time steps when using InflowWind.

Key Changes:

  • Moved K-d tree logic from AWAE_CalcOutput to a new subroutine CalcWakePointTurbineGridInteractions called in AWAE_UpdateStates
  • Relocated AWAE_UpdateStates call from FARM_UpdateStates to FARM_CalcOutput
  • Fixed timing bug in AWAE_Init and corrected time offsets in wind data retrieval calls

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
reg_tests/r-test Updated regression test baseline to reflect fixed wind velocity timing
modules/awae/src/AWAE.f90 Added new subroutine for K-d tree calculations, removed duplicate code from CalcOutput functions, and corrected time parameter usage throughout
glue-codes/fast-farm/src/FAST_Farm_Subs.f90 Moved AWAE_UpdateStates call from FARM_UpdateStates to FARM_CalcOutput and removed now-unused error handling variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deslaughter deslaughter merged commit 6d3ba82 into OpenFAST:dev-tc Dec 23, 2025
13 checks passed
@deslaughter deslaughter deleted the mv_ff_kdtree branch December 23, 2025 01:23
This was referenced Mar 12, 2026
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.

3 participants