openfast icon indicating copy to clipboard operation
openfast copied to clipboard

CalculateUACoeffs fails when iLow2 == iHigh2

Open deslaughter opened this issue 4 months ago • 2 comments

Bug description <A clear and concise description of the bug.>

The CalculateUACoefficients subroutine was modified in 030500ef2b402273c90853b01151e75b610b1e11 and the subroutine Calculate_C_alpha was added. Under some circumstances, the indices determined in this subroutine, iLow2 and iHigh2, are set to the same value. This seems to occur if min(Cd) is not close to alpha = 0. The logic used to determine alphaLower and alphaUpper results in a single point being passed to Calculate_C_alpha which requires at least two points to be provided to perform a linear curve fit. In Debug mode this results in a bounds access error in Calculate_C_alpha. In Release mode, no warning is produced though I'm not sure how the curve fit is successful.

To Reproduce <Update the following list with your specific information.> Steps to reproduce the behavior:

  1. Compile the dev branch in Debug
  2. Run any of the following regression tests:
  • AWT_YFix_WSt
  • AWT_WSt_StartUp_HighSpShutDown
  • AWT_YFree_WTurb
  • UAE_Dnwind_YRamp_WSt
  • WP_VSP_WTurb_PitchFail
  • SWRT_YFree_VS_EDG01
  1. Program exits with the array bound mismatch error shown below

Expected behavior <A clear and concise description of what you expected to happen.>

Simulation runs to completion.

Screenshots, if applicable <Add screenshots to help explain your problem.>

This is the backtrace produced by gfortran

Output:
----------------------------------------------------------
At line 1187 of file /projects/openfast.worktrees/dev/modules/aerodyn/src/AirfoilInfo.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'b' (2/1)

Error termination. Backtrace:
#0  0xffffaec9d08b in ???
#1  0xffffaec9ddb3 in ???
#2  0xffffaec9e2e7 in ???
#3  0xaaaae177686f in calculate_c_alpha
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AirfoilInfo.f90:1187
#4  0xaaaae177d3b3 in calculateuacoeffs
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AirfoilInfo.f90:1065
#5  0xaaaae178aa6b in readaffile
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AirfoilInfo.f90:757
#6  0xaaaae178c4f7 in __airfoilinfo_MOD_afi_init
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AirfoilInfo.f90:146
#7  0xaaaae0f32c07 in init_afiparams
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AeroDyn.f90:4376
#8  0xaaaae1038193 in __aerodyn_MOD_ad_init
	at /projects/openfast.worktrees/dev/modules/aerodyn/src/AeroDyn.f90:380
#9  0xaaaadff5f6a7 in __fast_subs_MOD_fast_initializeall
	at /projects/openfast.worktrees/dev/modules/openfast-library/src/FAST_Subs.f90:769
#10  0xaaaadffc0bb3 in __fast_subs_MOD_fast_initializeall_t
	at /projects/openfast.worktrees/dev/modules/openfast-library/src/FAST_Subs.f90:66
#11  0xaaaadfe6d33f in fast
	at /projects/openfast.worktrees/dev/glue-codes/openfast/src/FAST_Prog.f90:97
#12  0xaaaadfe6e237 in main
	at /projects/openfast.worktrees/dev/glue-codes/openfast/src/FAST_Prog.f90:34
/projects/openfast.worktrees/dev/build/glue-codes/openfast/openfast /projects/openfast.worktrees/dev/build/reg_tests/glue-codes/openfast/AWT_YFix_WSt/AWT_YFix_WSt.fst  > /projects/openfast.worktrees/dev/build/reg_tests/glue-codes/openfast/AWT_YFix_WSt/AWT_YFix_WSt.log
COMPLETE with code 2
<end of output>

OpenFAST Version <Please provide as much detail as possible including git commit. The best information is a screenshot of the OpenFAST system description that prints when running OpenFAST:>

dev branch commit 853ba8ca9f82d8bf1552638f9fa82af750750952

 **************************************************************************************************
 OpenFAST

 Copyright (C) 2024 National Renewable Energy Laboratory
 Copyright (C) 2024 Envision Energy USA LTD

 This program is licensed under Apache License Version 2.0 and comes with ABSOLUTELY NO WARRANTY.
 See the "LICENSE" file distributed with this software for details.
 **************************************************************************************************

 OpenFAST-dev
 Compile Info:
  - Compiler: GCC version 11.4.0
  - Architecture: 64 bit
  - Precision: double
  - OpenMP: No
  - Date: Oct  4 2024
  - Time: 20:10:17
 Execution Info:
  - Date: 10/04/2024
  - Time: 20:18:07+0000

System Information (please complete the following information):

  • OS: Ubuntu 22.04
  • Compiler: gfortran 11.4.0
  • Compiler settings: -DCMAKE_BUILD_TYPE=Debug

Additional context <Add any other context about the problem here.>

deslaughter avatar Oct 04 '24 20:10 deslaughter