Skip to content

InflowWind Hub Velocity Mapping for MHKs#3399

Merged
andrew-platt merged 1 commit into
OpenFAST:rc-5.0.1from
dzalkind:mhk_horwindv
Jul 21, 2026
Merged

InflowWind Hub Velocity Mapping for MHKs#3399
andrew-platt merged 1 commit into
OpenFAST:rc-5.0.1from
dzalkind:mhk_horwindv

Conversation

@dzalkind

Copy link
Copy Markdown
Contributor

Feature or improvement description

Fix MHK hub-height wind speed (HorWindV / avrSWAP(27)) and InflowWind hub velocity outputs (WindHubVelX/Y/Z) reporting zero for MHK turbines.

For MHK turbines, ElastoDyn reports the hub position in the MSL reference frame (e.g., Z = -24 m for the RM1 floating turbine). When this position is passed to InflowWind for the hub velocity query, IfW_FlowField_GetVelAcc checks Position(3) > 0 and returns zero velocity for any point at or below Z = 0. Since no coordinate offset was applied, the hub was seen as "underground" and the velocity was zeroed out.

AeroDyn already handles this correctly by adding PosOffset = [0, 0, WtrDpth] when querying InflowWind for blade/hub inflow. However, the separate hub velocity path used by ServoDyn (InflowWind_GetHubValuesHorWindVavrSWAP(27)) did not apply this offset.

This PR adds the WtrDpth offset to HubPosition(3) at the glue-code level before it is passed to InflowWind, consistent with the InflowWind documentation stating that all parameters should be "defined relative to the seabed" for MHK turbines. The fix is applied in:

  • FAST_Mapping.f90: Both Custom_ED_to_IfW and Custom_SED_to_IfW mappings
  • FAST_Subs.f90: The InflowWind initialization path where HubPosition is first set

This ensures all downstream InflowWind queries (HubVel, DiskVel, Lidar) receive the hub position in the seabed-referenced frame.

Related issue, if one exists

Impacted areas of the software

  • modules/openfast-library/src/FAST_Mapping.f90 — ED→IfW and SED→IfW custom input solve
  • modules/openfast-library/src/FAST_Subs.f90 — InflowWind initialization
  • ServoDyn Bladed-style DLL interface (avrSWAP(27))
  • InflowWind hub velocity, disk velocity, and Lidar outputs for MHK turbines

Additional supporting information

Root cause trace:

  1. FAST_Mapping.f90 maps HubPtMotion%Position (MSL frame, Z = -24 m for RM1) directly to IfW%Input%HubPosition
  2. InflowWind_GetHubValues passes HubPosition to IfW_FlowField_GetVelAcc with no PosOffset
  3. IfW_FlowField.f90 ~line 160: if (Position(3, i) > 0.0) → false → returns VelocityUVW = 0
  4. FAST_Mapping.f90 ~line 3627: HorWindV = sqrt(HubVel(1)^2 + HubVel(2)^2) = 0
  5. BladedInterface.f90 ~line 933: avrSWAP(27) = u%HorWindV = 0

AeroDyn does not have this problem because it applies PosOffset = [0, 0, WtrDpth] in AD_CalcWind_Rotor.

After fix, WindHubVelX reports ~1.93 m/s (the expected current speed at hub height) for the MHK_RM1_Floating test case, instead of 0.

I have a branch with MHK_RM1_Floating and MHK_RM1_Fixed regression tests updated to include WindHubVelX/Y/Z in the InflowWind OutList to capture this behavior going forward.

Generative AI usage

Assisted by: GitHub Copilot support@github.com

Test results, if applicable

  • r-test branch merging required — MHK_RM1_Floating and MHK_RM1_Fixed baselines need updating due to:
    1. New WindHubVelX/Y/Z output channels added to InflowWind OutList
    2. Changed simulation results from corrected hub position (hub velocity now non-zero, which may affect any coupled dynamics)

@dzalkind

Copy link
Copy Markdown
Contributor Author

I based my branch off of rc-5.0.1 which is why there's some extra commits here. I can do some git maneuvering or whatever the dev team prefers here to sort that out.

@andrew-platt
andrew-platt requested a review from Copilot July 21, 2026 21:23
@andrew-platt andrew-platt added this to the v5.0.1 milestone Jul 21, 2026
@andrew-platt
andrew-platt changed the base branch from dev to rc-5.0.1 July 21, 2026 21:24
@andrew-platt

Copy link
Copy Markdown
Collaborator

This is a good bugfix. I'm going to include it in 5.0.1 instead of 5.1.0 (we'll cross merge to dev soon).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes InflowWind hub-velocity queries for MHK turbines by shifting the hub Z position from an MSL-referenced frame to a seabed-referenced frame before passing it into InflowWind, preventing Position(3) <= 0 from being treated as “below seabed” and zeroing the velocity.

Changes:

  • Apply WtrDpth offset to the hub Z position during InflowWind initialization (FAST_Subs.f90) for MHK cases.
  • Apply the same WtrDpth offset to the hub Z position in the ED→IfW and SED→IfW custom input mappings (FAST_Mapping.f90) so runtime hub-velocity (and related) queries use the seabed-referenced hub position.
  • Includes additional changes outside the stated PR scope: YAML array formatting adjustments and a quaternion-to-DCM computation fix.

Reviewed changes

Copilot reviewed 51 out of 53 changed files in this pull request and generated no comments.

Show a summary per file
File Description
modules/openfast-library/src/FAST_Subs.f90 Offsets initial InflowWind hub Z position by WtrDpth for MHK turbines.
modules/openfast-library/src/FAST_Mapping.f90 Offsets mapped runtime InflowWind hub Z position by WtrDpth for MHK turbines (ED and SED paths).
modules/nwtc-library/src/YAML.f90 Adjusts generated format strings when AllFmt is provided for YAML 2D real arrays.
modules/nwtc-library/src/NWTC_Num.f90 Fixes Quaternion_to_DCM by correcting q3q3 to use q%v(3)**2.
modules/beamdyn/src/BeamDyn_IO.f90 Updates AllFmt strings passed to YAML writer for BeamDyn summary output.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@andrew-platt
andrew-platt merged commit 3ab28c2 into OpenFAST:rc-5.0.1 Jul 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants