Skip to content

Conversation

@bjonkman
Copy link
Contributor

@bjonkman bjonkman commented Aug 6, 2025

Feature or improvement description
This PR updates some of the code related to the AeroAcoustics module. It

  • removes unused code
  • fixes some numerics and error handling:
    • adds checks that AoA and Re are entered in increasing order and the use the same values in each BL table (the way the code expects it)
    • adds checks so that log10(0) does not occur. I've added a parameter, AA_EPSILON set to 1E-16, to indicate the smallest value allowed in the log equation.
    • calculates LE_Location in both UpdateStates and CalcOutput instead of the previous method that used old values in UpdateStates
    • uses bi-linear interpolation in the BL_Param_Interp() routine, allowing nearest-neighbor extrapolation for AoA as well as Re (previously allowed only Re).
  • calls AA_End in the AD_End routine, and in it, closes the text output files that AA had opened
  • fixes an issue where ADI_End was called twice, potentially causing memory issues.
  • updates the file output:
    • uses ".AA" instead of ".NN" as the module abbreviation used in the output file naming convention
    • puts the AA output file(s) in the main output directory (now relative to the output file locations, not the AA input file location)
    • makes sure the header in the "4.out" file contains the same number of lines as the other text output files (and follows the standard OpenFAST output format)
    • changes the formatting of the blade/node output channel names to match the AB#_N###_ChannelName format that is used in AeroDyn nodal outputs
    • adds a parameter, AA_OutputToSeparateFile that can be hardcoded to allow the outputs normally put in 4 separate text files (TRUE) to be sent to AeroDyn's WriteOutput array for output to the main OpenFAST output file (FALSE). It is set to TRUE now
  • allows the user to specify "default" as the AA output file name to use the <RootName>.AD.AA#.out naming convention
  • makes sure echo file contains all the lines it reads

Related issue, if one exists
none

Impacted areas of the software
AeroDyn/AeroAcoustics

Additional supporting information

Test results, if applicable
I don't believe that the current r-test framework checks the results of the AA text output files. I am aware of only one aeroacoustics r-test, and its output files are basically unchanged.

bjonkman added 30 commits July 16, 2025 12:24
- do not call `stop` on error
- check if fatal error occurs before moving on
also use `NumCoords` instead of checking size; size() does not necessarily work on unallocated arrays on some compilers
Make the inner loop vary fastest for efficiency
switch index 2 and 3 for efficiency
Was taking 3 lines instead of 1, so table started on different line in the file than all other text-based output files.
- output files that have relative names will be put in the directory relative to the primary output (determined by OutFileRoot)
- output file can now be specified as "DEFAULT" so that it can use the default OutFileRoot name (with same root as the echo file)
- added a check that the NrOutFile is a valid number between 1 and 4, and no longer allocate the AAOutFile array based on that; instead I made it an array of dimension 4, the maximum number of files it can contain.
- the AA output files now use the '.AA' nickname instead of '.NN'. For example, echo files will be <RootName>.AD.AA.ech
- remove UnEcho from AA_Init (needed only in the file reading routine)
- fix error handling in file read routines
- add echo file option to ReadBLTables()
- added more checks on data validity before allocating arrays based on sizes from input file data
- added check that each Reynolds number in the airfoil BL file contains the same AoA (which is what the code assumes in interpolation scheme)
- added check that each airfoil file contains the same Reynolds values if there are more than 1 listed in the file (code used to keep track of Re data from only the last airfoil file).
ITURB, IInflow, ITRIP, ILAM, ITIP, IBLUNT variables had parameters describing the valid cases, but the rest of the code hard-coded values. I changed the code to use the parameters for readability purposes.
interpolation routine assumes this, but it was never checked.
was making large jump near 0.
subroutines -> functions where appropriate
bi-linear interpolation, which will use nearest neighbor above/below AoA values not in the tables (instead of producing fatal error). AlphaNoise is also adjusted to be between [-180,180] before calling the routine, so hopefully that will help somewhat. There may be an issue of jumps if AoA is near +/-180 degrees if the tables aren't set up to handle large AoA.
- removed error handling that wasn't used in a meaningful way
- changed some subroutines to functions
…dn't produce errors

- removed unnecessary InitOutput variables (delim and version not necessary)
- nested some IF statements
- remove unused variables from registry (many discrete states, some parameters)
- made some parameters arrays instead of 4 separate variables
- moved output arrays to misc vars, since they are duplicates of the WriteOutput* arrays
- cleaned up some logic in exiting DO loops early
- close output files on end
bjonkman added 7 commits July 31, 2025 09:36
- moved integer-like discrete state to other state (allregcounter)
- removed variables and calculations that weren't used
- made observer XYZ locations a 2-dim array instead of 3 separate arrays
- condensed duplicate calculations in `CalcAeroAcousticsOutput`
- update `LE_Location` on UpdateStates routine instead of reusing old values from CalcOutput
- added more documentation on which routines are using rad vs deg for AoA
@andrew-platt andrew-platt self-assigned this Aug 6, 2025
@andrew-platt andrew-platt added this to the v4.2.0 milestone Aug 6, 2025
Copy link
Contributor

@ptrbortolotti ptrbortolotti left a comment

Choose a reason for hiding this comment

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

I will have to try it, but for now thank you for all the cleaning up

Copy link
Collaborator

@andrew-platt andrew-platt left a comment

Choose a reason for hiding this comment

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

thanks for fixing these issues and reorganizing the code!

@andrew-platt andrew-platt merged commit d9d0098 into OpenFAST:dev Aug 11, 2025
12 checks passed
@bjonkman bjonkman deleted the b/AeroAcoustics branch August 11, 2025 21:19
@andrew-platt andrew-platt mentioned this pull request Jan 23, 2026
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants