Repository navigation
AD: fix stale inflow passed to BEMT in AD_UpdateStates - #3502
Draft
andrew-platt wants to merge 1 commit into
Draft
andrew-platt wants to merge 1 commit into
andrew-platt wants to merge 1 commit into
Conversation
In AD_UpdateStates, the wind computed for each BEMT input time was written to m%Inflow(1) and never read; SetInputs read InflowInterp, which was set once before the loop. Both BEMT input slots (t and t+dt) therefore received the same wind. The wind was also sampled at utimes(i) rather than BEMT_utimes(i), and m%Inflow(1) was overwritten before SetInputsForAA and SetInputsForFVW read it. Calculate the wind at BEMT_utimes(i) into InflowInterp, restoring its role as the per-iteration scratch buffer (regression from 8024b98). Assisted-by: Claude Code:claude-opus-5-5 [Bash] [Read] [Edit]
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Maintainers need to assess widespread regression differences from numerical forcing changes across BEMT/DBEMT/UA and AeroAcoustics/OLAF before baseline regeneration and merging.
No open issues 🎉
What changed in this PR
Fixes stale inflow in AeroDyn’s AD_UpdateStates so BEMT state updates use wind sampled at the correct time and interpolated node positions.
Changes:
- Samples wind at
BEMT_utimes(i)intoInflowInterp, the buffer consumed bySetInputs. - Preserves the original inflow samples for downstream AeroAcoustics and OLAF inputs.
Regression baselines remain pending before merge; the no-FlowField path is unchanged.
| File | Description |
|---|---|
modules/aerodyn/src/AeroDyn.f90 |
Corrects the wind-sampling time and destination buffer in AD_UpdateStates. |
Review effort: Balanced
andrew-platt
marked this pull request as draft
October 29, 2026 00:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOT READY FOR MERGING
This PR changes many regression results. It should be one of the last PRs merged before the 5.0.1 release; baselines will be regenerated at that time.
Feature or improvement description
In
AD_UpdateStates, the wind computed for each BEMT input time was written tom%Inflow(1)and never used.SetInputsreadInflowInterpinstead, which is set only once before the loop. Both BEMT inputs (m%BEMT_u(1)attandm%BEMT_u(2)att+dt) therefore got the same wind, so the BEMT/DBEMT/UA states were advanced as if the inflow did not change over the step.There were two related problems on the same line:
utimes(i)(whereutimes = [t+dt, t]), butuInterpholds the node positions atBEMT_utimes(i)([t, t+dt]). The time and the positions did not match.m%Inflow(1)was overwritten, soSetInputsForAAandSetInputsForFVW(index 1) later in the routine pairedu(1)with the wrong inflow.The fix is one line: calculate the wind at
BEMT_utimes(i)intoInflowInterp.This puts
InflowInterpback to how it was used before commit 8024b98 ("AD15: calculate wind based on u_interp instead of extrapolating"): a temporary buffer that is refilled on every pass through the loop.m%Inflow(1:2)are no longer changed in the loop.This replaces #3480, which had the same source change plus tests that are not needed.
Related issue, if one exists
Closes #3447
Supersedes #3480
Impacted areas of the software
AD_UpdateStates(BEMT / DBEMT / UA state updates, AeroAcoustics inputs, OLAF inputs at index 1)Additional supporting information
AD_CalcWindreturns right away whenFlowFieldis not associated),InflowInterpstays a copy ofm%Inflow(1). Both BEMT inputs keep gettingu(1)'s inflow, as they do today. This PR does not change that path.Generative AI usage
Claude Code (claude-opus-5-5) was used to review the issue and #3480, make the one-line change, and draft this description. The change was reviewed by the author.
Assisted-by: Claude Code:claude-opus-5-5 [Bash] [Read] [Edit]
Test results, if applicable
Results change for cases where the wind seen by the blades varies over one
DT_Aero: turbulent or time-varying wind, shear with a rotating rotor, large platform or blade motion, MHK cases with waves, and cases using AeroAcoustics or OLAF. Steady, uniform wind with little motion should not change. Regression baselines will be updated in r-test just before this PR is merged.