cross merge rc-5.0.1 into dev - #3432
Merged
Merged
Conversation
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>
…ridType=1 for list-based grids
… StructuredPoints (range)
Optimize GridInterp tensor-product cubic interpolation
…ard all allocations
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
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>
…3d-cubic-interp-nan
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>
…an' into bugfix/ifw-grid3d-cubic-interp-nan
…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>
…calculated before
…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
Contributor
There was a problem hiding this comment.
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.
Collaborator
Author
|
Before merging this:
|
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
luwang00
approved these changes
Aug 18, 2026
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.
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
DT_Mooringrestrictions even with moorings off #3421: Guard DT_mooring validation with mooring enabled check (Commit 7ecaa0e)BldPrcnt = 100uses only the outermost two blade nodes instead of the whole blade #3416 (Commit 6ac408c)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