[BugFix] BeamDyn nodal outputs occasionally segfaulted #996
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 for merging
Feature or improvement description
BeamDyn would occasionally incur a segmentation fault when nodal outputs were requested. This appeared to happen only with certain Intel compiler version on Windows and was difficult to reproduce reliably. The root cause was the first entry in
NdIndxInverse
index lookup table not getting set (this index table is used to map the quadrature point node to the correct nodal output channel). Thus the first index value would be whatever was resident in that memory location and might be a value outside the range of the output nodes which would result in a segmentation fault.For whatever reason, I could only reproduce this error with some Intel compiles on Windows. It did not show up on Linux or with the gcc compilers. Maybe this is due to different memory layout or previous stored values in the particular memory space (hard to tell without spending more time on the issue).
This issue only affected the indexing for the first node, so may in some instances have caused incorrect outputs for the first node nodal outputs to not match the root outputs.
Related issue, if one exists
Maybe related: #248
Noted in forum post: https://forums.nrel.gov/t/sending-rtaeropwr-via-servodyn-to-bladed-style-dll-controller/2043/14
Impacted areas of the software
BeamDyn node based outputs are the only bit of code affected.