Skip to content

Commit

Permalink
Merge pull request #2397 from luwang00/b/HD_PFBdy_Output
Browse files Browse the repository at this point in the history
HD bug fix: prevent array index out-of-bound error in HDOut_MapOutputs when more than 9 potential-flow bodies are present
  • Loading branch information
andrew-platt committed Aug 29, 2024
2 parents d6e3148 + d97ee66 commit cca59dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/hydrodyn/src/HydroDyn_Output.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ SUBROUTINE HDOut_MapOutputs( CurrentTime, p, y, m_WAMIT, m_WAMIT2, NWaveElev, Wa
! Need to use individual components of force for output reporting, the y%mesh data has total forces from all contributions
if ( p%potMod == 1 ) then
if ( p%NBodyMod == 1 .or. p%NBody == 1 ) then
do iBody = 1,p%NBody
do iBody = 1,min(p%NBody,9) ! Can only output the first 9 bodies for now
startIndx = 6*(iBody-1) + 1
endIndx = startIndx + 5
AllOuts(FWaves1 (:,iBody)) = m_WAMIT(1)%F_Waves1(startIndx:endIndx)
Expand All @@ -1179,7 +1179,7 @@ SUBROUTINE HDOut_MapOutputs( CurrentTime, p, y, m_WAMIT, m_WAMIT2, NWaveElev, Wa
! This happens when NBodyMod > 1, in which case, each WAMIT object is for a single body, but there may be multiple bodies in the HydroDyn model,
! so we need to use BodyID to determine the index into the complete HydroDyn list of WAMIT bodies

do iBody = 1,p%NBody
do iBody = 1,min(p%NBody,9) ! Can only output the first 9 bodies for now
startIndx = 6*(iBody-1) + 1
endIndx = startIndx + 5
AllOuts(FWaves1 (:,iBody)) = m_WAMIT(iBody)%F_Waves1
Expand Down

0 comments on commit cca59dc

Please sign in to comment.