Skip to content

cross merge rc-5.0.1 into dev - #3432

Merged
andrew-platt merged 48 commits into
devfrom
m/rc501_dev
Aug 19, 2026
Merged

cross merge rc-5.0.1 into dev#3432
andrew-platt merged 48 commits into
devfrom
m/rc501_dev

Conversation

@andrew-platt

@andrew-platt andrew-platt commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Ready to merge once regression tests pass

Feature or improvement description
Several bugfixes were added into rc-5.0.1 that would be useful to have in dev now

PRs included in this cross merge
Bugfixes

Other PRs included in this merge that are optimizations or new features rather than specifically designated as bug fixes are:

Test results, if applicable
New test results not in rc-5.0.1 may change

  • r-test branch merging required

luwang00 and others added 30 commits July 30, 2026 18:19
Speed up the 3D/4D grid interpolation routines in the NWTC Library
while preserving the public interface and functionality. Results are
numerically equivalent, differing only at floating-point truncation
level from a strictly serial evaluation.

Changes:
- Setup routines (3D/4D/N): build the weight tensors with array syntax
  over the contiguous first dimension so the inner writes vectorize,
  and hoist shared subexpressions (e.g. Nkl = N1D(k,3)*N1D(l,4)).
- Scalar and vector interpolation routines: accumulate over the
  innermost dimension into four independent partial sums to break the
  serial add dependency chain (latency hiding) and expose ILP, then
  combine at the end. Index lookups are hoisted out of the inner loop.
- Vector routines: move the component (vi) loop outermost for
  unit-stride access and per-component accumulation.
- Slope routines (N/S): accumulate both derivatives with dual
  accumulators and reuse a single data load per grid point instead of
  loading the same value twice.

Validation: all 10 SeaState regression tests pass, and the HydroDyn
WAMIT interpolation paths (including hd_NBodyMod1) pass. gfortran does
not reassociate reduction sums by default, so the multi-accumulator
regrouping is the primary win.

Co-authored-by: GitHub Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus <claude@anthropic.com>
Optimize GridInterp tensor-product cubic interpolation
Updated the .gitignore for vscode containers / workspaces
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fix: print warning/error console messages (Intel Fortran compiler)
OLAF: VTK outputs at non-equidistant grid points (nGridOut)
- 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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fix bug in bldprcnt following issue #3416
andrew-platt and others added 11 commits August 12, 2026 14:02
IfW_FlowField_GetVelAcc only populated the local AccCell array when
the caller requested acceleration output (OutputAccel). But the cubic
Hermite velocity formula in Grid3DField_GetVelAccCubic depends on
AccCell for its tangent terms regardless of whether acceleration is
separately requested. Callers that use VelInterpCubic=True but only
want velocity (e.g. AWAE's ambient-wind sampling) therefore computed
velocity from uninitialized memory, corrupting every returned value.

Also fixes IfW_Grid3DField_CalcAccel, which checked G3D%NTGrids (tower
grid point count) instead of G3D%NSteps (time step count) to decide
whether to compute real cubic-spline time derivatives, forcing
G3D%Acc to zero for every case without a tower file regardless of how
many time steps were available.

Adds unit tests (test_grid3d_field.F90) that reproduce both defects
in isolation and verify the fix.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
IfW_FlowField_GetVelAcc only populated the local AccCell array when
the caller requested acceleration output (OutputAccel). But the cubic
Hermite velocity formula in Grid3DField_GetVelAccCubic depends on
AccCell for its tangent terms regardless of whether acceleration is
separately requested. Callers that use VelInterpCubic=True but only
want velocity (e.g. AWAE's ambient-wind sampling) therefore computed
velocity from uninitialized memory, corrupting every returned value.

Also fixes IfW_Grid3DField_CalcAccel, which checked G3D%NTGrids (tower
grid point count) instead of G3D%NSteps (time step count) to decide
whether to compute real cubic-spline time derivatives, forcing
G3D%Acc to zero for every case without a tower file regardless of how
many time steps were available.

Adds unit tests (test_grid3d_field.F90) that reproduce both defects
in isolation and verify the fix.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…NSteps)

IfW_Grid3DField_CalcAccel's tower-grid branch checked G3D%NTGrids < 3 to
decide whether to zero out tower acceleration, but the actual time-derivative
calculation needs G3D%NSteps >= 3 (already guaranteed by the earlier
NSteps<3 early return). This mirrors the NTGrids/NSteps mix-up fixed
elsewhere in this PR, and incorrectly zeroed valid tower acceleration
whenever a wind file had only 1 or 2 tower grid points. Removed the
erroneous guard; the tower acceleration loop needs no minimum tower
height count.

Added test_grid3d_calcaccel_few_tower_points to cover this case.

Co-authored-by: GitHub Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…terp-nan

Fix InflowWind Grid3D cubic velocity interpolation NaN bug
At L:620 of FAST_writer.py contains a str + int type error. Patched with the missing str() casting function
@andrew-platt
andrew-platt requested review from rthedin and a lite review from Copilot August 17, 2026 20:14
@andrew-platt andrew-platt self-assigned this Aug 17, 2026
@andrew-platt andrew-platt added the Code-dev: cross-merges and maintenance Cross-merges between development branches. This is mostly code development maintenance. label Aug 17, 2026

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 cross-merges bugfixes from rc-5.0.1 into dev, including correctness fixes in InflowWind’s Grid3D cubic interpolation path, OLAF grid-output enhancements for non-equidistant grids, and several infrastructure/test updates.

Changes:

  • Fix Grid3D cubic-velocity interpolation behavior in InflowWind and add targeted regression unit tests.
  • Add support for non-equidistant OLAF grid output points via list files, including VTK output handling and documentation.
  • Miscellaneous fixes/refactors: console record-length constants, GridInterp loop optimizations, FAST.Farm MoorDyn file existence validation, and small repo hygiene updates.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
unit_tests/CMakeLists.txt Adds new InflowWind Grid3D unit test source to the test build.
modules/nwtc-library/src/SysMatlabWindows.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysMatlabLinuxIntel.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysMatlabLinuxGnu.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysIVF.f90 Aligns console record length and maximum write length constants; whitespace/doc cleanup.
modules/nwtc-library/src/SysIVF_Labview.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysIFL.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysGnuWin.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysGnuLinux.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/SysFlangLinux.f90 Aligns console record length and maximum write length constants.
modules/nwtc-library/src/GridInterp.f90 Refactors interpolation setup/evaluation loops for improved performance and fewer redundant index lookups.
modules/inflowwind/tests/test_grid3d_field.F90 Adds regression tests covering Grid3D cubic interpolation and acceleration-field derivation logic.
modules/inflowwind/tests/inflowwind_utest.F90 Registers the new Grid3D Field testsuite.
modules/inflowwind/src/IfW_FlowField.f90 Fixes Grid3D cubic interpolation dependency on acceleration-field availability; corrects CalcAccel logic around NSteps vs tower grid counts.
modules/aerodyn/src/FVW_Types.f90 Extends OLAF grid output type to include explicit axis point arrays and list-file paths; updates copy/pack/unpack/destroy.
modules/aerodyn/src/FVW_Subs.f90 Uses explicit axis point arrays (xPts/yPts/zPts) when enumerating grid points.
modules/aerodyn/src/FVW_Registry.txt Registers new GridOutType fields for serialization.
modules/aerodyn/src/FVW_IO.f90 Parses list-file-based axes, resolves grid axes to explicit coordinate arrays, validates vorticity constraints, and updates VTK output to rectilinear grids when needed.
modules/aerodyn/src/AeroAcoustics.f90 Adjusts blade-span selection logic for noise calculations and adds an input warning.
glue-codes/fast-farm/src/FAST_Farm_IO.f90 Validates existence of the MoorDyn input file for shared mooring mode.
docs/source/user/aerodyn-olaf/InputFiles.rst Documents non-equidistant OLAF grid points via list files and vorticity limitations.
.gitignore Ignores devcontainer/docker/VScode workspace artifacts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread modules/aerodyn/src/AeroAcoustics.f90 Outdated
Comment thread modules/inflowwind/src/IfW_FlowField.f90 Outdated
Comment thread modules/aerodyn/src/FVW_IO.f90
Comment thread modules/aerodyn/src/FVW_Types.f90
Comment thread modules/aerodyn/src/FVW_IO.f90
@andrew-platt

andrew-platt commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

Before merging this:

andrew-platt and others added 6 commits August 17, 2026 14:50
Fix three code quality issues identified by GitHub Copilot in PR #3432:

1. AeroAcoustics.f90: Prevent out-of-bounds array access
   - Add guard for single-node case (NumBlNds==1)
   - Calculate LastElemPct safely without accessing NumBlNds-1 index
   - When NumBlNds==1, treat element as spanning entire blade (100%)

2. IfW_FlowField.f90: Improve error messaging for cubic interpolation
   - Clarify why acceleration field is required for cubic velocity interpolation
   - Provide context-specific error messages for three scenarios:
     * Both acceleration output and cubic interpolation enabled
     * Only acceleration output requested
     * Only cubic velocity interpolation enabled

3. FVW_IO.f90: Add I/O error handling in ResolveGridAxis
   - Add iostat check to grid point list file read loop
   - Return controlled error with line number and filename on read failure
   - Prevent unhandled runtime crashes from malformed/truncated files

Co-authored-by: GitHub Copilot <noreply@github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix three code quality issues identified by GitHub Copilot in PR #3432:

1. AeroAcoustics.f90: Prevent out-of-bounds array access
   - Add guard for single-node case (NumBlNds==1)
   - Calculate LastElemPct safely without accessing NumBlNds-1 index
   - When NumBlNds==1, treat element as spanning entire blade (100%)

2. IfW_FlowField.f90: Improve error messaging for cubic interpolation
   - Clarify why acceleration field is required for cubic velocity interpolation
   - Provide context-specific error messages for three scenarios:
     * Both acceleration output and cubic interpolation enabled
     * Only acceleration output requested
     * Only cubic velocity interpolation enabled

3. FVW_IO.f90: Add I/O error handling in ResolveGridAxis
   - Add iostat check to grid point list file read loop
   - Return controlled error with line number and filename on read failure
   - Prevent unhandled runtime crashes from malformed/truncated files

Co-authored-by: GitHub Copilot <noreply@github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Address two wording improvements suggested by Copilot in PR #3433:

1. IfW_FlowField.f90: Use consistent terminology
   - Changed 'accel field' to 'the acceleration field' in all three
     error messages for consistency within the same conditional block

2. FVW_IO.f90: Improve read error diagnostics
   - Changed 'line j' to 'grid point #j' (j is entry index, not line)
   - Added iostat code to error message for better troubleshooting
   - List-directed READ can consume multiple values per line, so
     reporting it as a line number was misleading

Co-authored-by: GitHub Copilot <noreply@github.com>
Found and fixed a type cast missing in FAST_writer.py
Fix GitHub Copilot identified issues in rc-5.0.1 cross-merge
@andrew-platt
andrew-platt requested review from luwang00 and removed request for rthedin August 18, 2026 16:24
@andrew-platt
andrew-platt merged commit 7a8c5c5 into dev Aug 19, 2026
48 of 69 checks passed
@andrew-platt
andrew-platt deleted the m/rc501_dev branch August 19, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code-dev: cross-merges and maintenance Cross-merges between development branches. This is mostly code development maintenance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants