Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: UA driver aero-elastic simulation had wrong sign #2357

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/aerodyn/src/UnsteadyAero.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ subroutine UA_Init_Outputs(InitInp, p, y, InitOut, errStat, errMsg)

! --- Write to File
if ((p%NumOuts > 0) .and. p%UA_OUTS==2) then
call WrScr(' UA: Writing separate output file: '//trim((InitInp%OutRootName)//'.out'))
call WrScr(' UA: Writing separate output file: '//trim(InitInp%OutRootName)//'.out')
CALL GetNewUnit( p%unOutFile, ErrStat2, ErrMsg2 )
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
Expand Down
11 changes: 7 additions & 4 deletions modules/lindyn/src/LinDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ end subroutine LD_InitInputData
!----------------------------------------------------------------------------------------------------------------------------------
!> Compute A and B state matrices for a linear mechanical system
!! NOTE: Generic function (no derived types), keep it that way
!! A = [ 0 I ] B = [0 ]
!! [-M^{-1}K -M^{-1}C ] = [-M^{-1}]
!! A = [ 0 I ] B = [ 0 ]
!! [-M^{-1}K -M^{-1}C ] = [ M^{-1} ]
subroutine StateMatrices(MM, CC, KK, AA, BB, errStat, errMsg)
real(ReKi), intent(in ) :: MM(:,:)
real(ReKi), intent(in ) :: CC(:,:)
Expand All @@ -251,6 +251,7 @@ subroutine StateMatrices(MM, CC, KK, AA, BB, errStat, errMsg)
integer(IntKi) :: errStat2 ! Status of error message
bjonkman marked this conversation as resolved.
Show resolved Hide resolved
character(1024) :: errMsg2 ! Error message if ErrStat /= ErrID_None
integer :: nx, nq, i

real(ReKi), dimension(:,:), allocatable :: MLU ! LU factorization of M matrix
real(ReKi), dimension(:,:), allocatable :: MinvX ! Tmp array to store either: M^{-1} C, M^{-1} K , or M^{-1}
real(ReKi), dimension(:) , allocatable :: WORK ! LAPACK variable
Expand Down Expand Up @@ -291,10 +292,12 @@ subroutine StateMatrices(MM, CC, KK, AA, BB, errStat, errMsg)
! Inverse of M
MinvX = MLU
LWORK=nx*nx ! Somehow LWORK = -1 does not work
allocate(WORK(LWORk))
call AllocAry(WORK, LWORk, 'WORK', errStat2, errMsg2); if(Failed()) return
call LAPACK_getri(nx, MinvX, IPIV, WORK, LWORK, errStat2, errMsg2); if(Failed()) return
BB(nx+1:nq, : ) = -MinvX
BB(nx+1:nq, : ) = MinvX

call CleanUp()

contains
logical function Failed()
call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'StateMatrices' )
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/executeUnsteadyAeroRegressionCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def Error(msg):
for dvrf in dvrFiles:
simName = os.path.splitext(os.path.basename(dvrf))[0]
localOutFile = os.path.join(testBuildDirectory, simName + '.outb')
baselineOutFile = os.path.join(inputsDirectory, simName + '.out') # TODO TODO
baselineOutFile = os.path.join(inputsDirectory, simName + '.outb') # TODO TODO

if not os.path.exists(localOutFile):
Error('File does not exist: {}'.format(localOutFile))
Expand Down