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

BeamDyn bug fixes and updates #114

Merged
merged 35 commits into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
87120a6
Minor rearrangement of the BD_RotationalInterpQP routine.
May 10, 2017
532c604
Moved another root curve compose with the transpose of itself outside…
May 11, 2017
c06a69f
Updated ED CoordSys to use double precision on all trig functions
bjonkman May 30, 2017
dc7e2bf
BD code cleanup and bug fixes
bjonkman May 31, 2017
eb6f72a
BD: fixed number of nodes on redefined u%DistrLoad mesh
bjonkman Jun 1, 2017
18f6fcb
Merge branch 'dev' into f/Envision-BeamDyn
bjonkman Jun 27, 2017
2b3fbce
BD driver bug fixes
bjonkman Jul 3, 2017
87fd9cd
BD: updated BD_CrvExtractCrv for more robust arithmetic
bjonkman Jul 11, 2017
97d1c2a
Fix for issue #26: BeamDyn initialization with non-zero initial azimuth
bjonkman Aug 14, 2017
0829f84
BD: fixed local sectional loads and other issues
bjonkman Aug 14, 2017
36f185a
BD code cleanup, performance improvements
bjonkman Oct 26, 2017
1fe20c3
BD driver was missing an IMPLICIT NONE statement
bjonkman Dec 1, 2017
b7e9a3d
Merged OpenFAST/dev into Envision BeamDyn changes
bjonkman Dec 2, 2017
63c2c02
Updated spacing, removed unused variables
bjonkman Dec 2, 2017
4fc9281
Fixed some potential memory leaks on error handling
bjonkman Dec 2, 2017
b92f8ae
bugfix: BD driver vs-build was creating UA instead of BD types.
bjonkman Dec 2, 2017
47ea218
Updated BD_CrvExtractCrv with arrays
bjonkman Dec 2, 2017
827ef06
Removed unused variables and added extra IF around #def statement in MAP
bjonkman Dec 2, 2017
dbd9853
Removed duplicated code from OpenFAST merge
bjonkman Dec 2, 2017
7c600c3
Fixed coding in BD unit tests
bjonkman Dec 2, 2017
8736b29
Removed more duplicated code from OpenFAST merge
bjonkman Dec 2, 2017
00ff7da
BD bugfix: incorrect orientations sent to FAST
bjonkman Dec 18, 2017
67954f3
Merge branch 'f/Envision-BeamDyn' into f/EE-BeamDyn-OpenFAST-dev
bjonkman Jan 9, 2018
04dc5e5
removed extra comments
bjonkman Jan 10, 2018
534cd6d
Merge branch 'f/Envision-BeamDyn' into f/EE-BeamDyn-OpenFAST-dev
bjonkman Jan 10, 2018
df45545
BD driver bug fix: error status not reset
bjonkman Jan 19, 2018
7a77770
BD "Newton-Ralphson" changed to "Newton-Raphson"
bjonkman Jan 24, 2018
9e33c39
Fixed another "Ralphson" typo
bjonkman Jan 24, 2018
97598cd
Merge branch 'f/Envision-BeamDyn' into f/EE-BeamDyn-OpenFAST-dev
bjonkman Jan 29, 2018
7c3cfd9
Merge branch 'openfast/dev' into f/EE-BeamDyn-OpenFAST-dev
rafmudaf May 8, 2018
e39c17b
Unit test bug fixes and comment cleanup
rafmudaf May 8, 2018
533218c
Bug fix: remove a bad line ending character
rafmudaf May 8, 2018
7678efe
Add an additional BeamDyn regression test
rafmudaf May 8, 2018
6c60b68
Improve load stepping in BD_Static
rafmudaf May 8, 2018
1a173ca
Update the regression test baseline solutions
rafmudaf May 11, 2018
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: 2 additions & 0 deletions modules-ext/map/src/simclist/simclist.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@

/* disable asserts */
#ifndef SIMCLIST_DEBUG
#ifndef NDEBUG
#define NDEBUG
#endif
#endif

#include <assert.h>

Expand Down
2,025 changes: 1,204 additions & 821 deletions modules-local/beamdyn/src/BeamDyn.f90

Large diffs are not rendered by default.

58 changes: 37 additions & 21 deletions modules-local/beamdyn/src/BeamDyn_IO.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!**********************************************************************************************************************************
! LICENSING
! Copyright (C) 2015-2016 National Renewable Energy Laboratory
! Copyright (C) 2016-2017 Envision Energy USA, LTD
! Copyright (C) 2016-2017 Envision Energy USA, LTD
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@ MODULE BeamDyn_IO
USE BeamDyn_Types
USE BeamDyn_Subs
USE NWTC_Library
USE NWTC_LAPACK
!USE NWTC_LAPACK

IMPLICIT NONE

Expand Down Expand Up @@ -564,7 +564,6 @@ SUBROUTINE BD_ReadPrimaryFile(InputFile,InputFileData,OutFileRoot,UnEc,ErrStat,E
LOGICAL :: Echo ! Determines if an echo file should be written
INTEGER(IntKi) :: IOS ! Temporary Error status
CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message
CHARACTER(ErrMsgLen) :: ErrMsg_NoBldNdOuts ! Temporary Error message
character(*), parameter :: RoutineName = 'BD_ReadPrimaryFile'

CHARACTER(1024) :: PriPath ! Path name of the primary file
Expand Down Expand Up @@ -1345,7 +1344,7 @@ SUBROUTINE BD_ValidateInputData( InputFileData, ErrStat, ErrMsg )
ErrMsg = ""


IF(InputFileData%analysis_type .NE. 1 .AND. InputFileData%analysis_type .NE. 2) &
IF(InputFileData%analysis_type .NE. BD_STATIC_ANALYSIS .AND. InputFileData%analysis_type .NE. BD_DYNAMIC_ANALYSIS) &
CALL SetErrStat ( ErrID_Fatal, 'Analysis type must be 1 (static) or 2 (dynamic)', ErrStat, ErrMsg, RoutineName )
IF(InputFileData%rhoinf .LT. 0.0_BDKi .OR. InputFileData%rhoinf .GT. 1.0_BDKi) &
CALL SetErrStat ( ErrID_Fatal, 'Numerical damping parameter \rho_{inf} must be in the range of [0.0,1.0]', ErrStat, ErrMsg, RoutineName )
Expand All @@ -1359,11 +1358,21 @@ SUBROUTINE BD_ValidateInputData( InputFileData, ErrStat, ErrMsg )
CALL SetErrStat ( ErrID_Fatal, 'member_total must be greater than 0', ErrStat, ErrMsg, RoutineName )
IF(InputFileData%member_total .NE. 1 .AND. InputFileData%quadrature .EQ. TRAP_QUADRATURE) &
CALL SetErrStat ( ErrID_Fatal, 'Trapzoidal quadrature only allows one member (element)', ErrStat, ErrMsg, RoutineName )
IF(InputFileData%kp_total .LT. 3 ) then
IF(InputFileData%kp_total .LT. 3 ) THEN
CALL SetErrStat ( ErrID_Fatal, 'kp_total must be greater than or equal to 3', ErrStat, ErrMsg, RoutineName )
else IF ( .not. EqualRealNos( InputFileData%kp_coordinate(1,3), 0.0_BDKi ) ) then ! added this in the "else" in case InputFileData%kp_coordinate isn't allocated with at least 1 point
CALL SetErrStat(ErrID_Fatal, 'kp_zr on first key point must be 0.', ErrStat, ErrMsg, RoutineName )
end if
ELSE ! added this in the "else" in case InputFileData%kp_coordinate isn't allocated with at least 1 point
IF ( .not. EqualRealNos( InputFileData%kp_coordinate(1,3), 0.0_BDKi ) ) THEN
CALL SetErrStat(ErrID_Fatal, 'kp_zr on first key point must be 0.', ErrStat, ErrMsg, RoutineName )
END IF
!bjj: added checks on kp_xr(1) and kp_yr(1) because BeamDyn's equations currently assume that the blade root and the first FE node
! are at the same point (i.e., u%BladeRoot is located at the first finite-element node)
IF ( .not. EqualRealNos( InputFileData%kp_coordinate(1,2), 0.0_BDKi ) ) THEN
CALL SetErrStat(ErrID_Fatal, 'kp_yr on first key point must be 0.', ErrStat, ErrMsg, RoutineName )
END IF
IF ( .not. EqualRealNos( InputFileData%kp_coordinate(1,1), 0.0_BDKi ) ) THEN
CALL SetErrStat(ErrID_Fatal, 'kp_xr on first key point must be 0.', ErrStat, ErrMsg, RoutineName )
END IF
END IF

DO i=1,InputFileData%member_total
IF(InputFileData%kp_member(i) .LT. 3) THEN
Expand Down Expand Up @@ -1399,6 +1408,7 @@ SUBROUTINE BD_ValidateInputData( InputFileData, ErrStat, ErrMsg )
! Check that the values for the damping are similar.
! According to Qi, the damping values mu1 .. mu6 should be of the same order of magnitude. If they aren't, BeamDyn will likely fail badly.
! Will assume for moment that they must be within a factor of 5 of the first value given.
!FIXME: Check a valid range sometime.
DO j=1,6
IF ( maxval( abs(InputFileData%InpBl%beta / InputFileData%InpBl%beta(J) ) ) > 5.0_R8Ki ) THEN
call SetErrStat( ErrID_Warn,'Damping values in blade file are not of similar order of magnitude! BeamDyn will likely not converge!', ErrStat, ErrMsg, RoutineName )
Expand Down Expand Up @@ -1522,8 +1532,8 @@ SUBROUTINE Calc_WriteOutput( p, AllOuts, y, m, ErrStat, ErrMsg )
call LAPACK_DGEMM('N', 'T', 1.0_BDKi, y%BldMotion%RefOrientation(:,:,y%BldMotion%NNodes), RootRelOrient, 0.0_BDKi, temp33_2, ErrStat2, ErrMsg2 )
call LAPACK_DGEMM('T', 'N', 1.0_BDKi, y%BldMotion%Orientation( :,:,y%BldMotion%NNodes), temp33_2, 0.0_BDKi, temp33, ErrStat2, ErrMsg2 )
call BD_CrvExtractCrv(temp33,temp_vec2, ErrStat2, ErrMsg2) ! temp_vec2 = the Wiener-Milenkovic parameters of the tip angular/rotational defelctions
CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
temp_vec = MATMUL(m%u2%RootMotion%Orientation(:,:,1),temp_vec2) ! translate these parameters to the correct system for output

AllOuts( TipRDxr ) = temp_vec(1)
Expand Down Expand Up @@ -1562,23 +1572,21 @@ SUBROUTINE Calc_WriteOutput( p, AllOuts, y, m, ErrStat, ErrMsg )
!------------------------------------

! outputs on the nodes
do beta=1,p%NNodeOuts
DO beta=1,p%NNodeOuts

j=p%OutNd(beta)
j_BldMotion = p%NdIndx(j)

!------------------------------------
! Sectional force resultants at Node 1 expressed in l, given in N
!FIXME: N#Mxl & N#Myl are known to be incorrect! See https://wind.nrel.gov/forum/wind/viewtopic.php?f=3&t=1622
temp_vec = MATMUL(y%BldMotion%Orientation(:,:,j_BldMotion), m%BldInternalForce(1:3,j_BldMotion))
temp_vec = MATMUL(y%BldMotion%Orientation(:,:,j_BldMotion), m%BldInternalForceFE(1:3,j))
AllOuts( NFl( beta,1 ) ) = temp_vec(1)
AllOuts( NFl( beta,2 ) ) = temp_vec(2)
AllOuts( NFl( beta,3 ) ) = temp_vec(3)

!------------------------------------
! Sectional moment resultants at Node 1 expressed in l, given in N-m
!FIXME: N#Mxl & N#Myl are known to be incorrect! See https://wind.nrel.gov/forum/wind/viewtopic.php?f=3&t=1622
temp_vec = MATMUL(y%BldMotion%Orientation(:,:,j_BldMotion), m%BldInternalForce(4:6,j_BldMotion))
temp_vec = MATMUL(y%BldMotion%Orientation(:,:,j_BldMotion), m%BldInternalForceFE(4:6,j))
AllOuts( NMl( beta,1 ) ) = temp_vec(1)
AllOuts( NMl( beta,2 ) ) = temp_vec(2)
AllOuts( NMl( beta,3 ) ) = temp_vec(3)
Expand All @@ -1588,7 +1596,7 @@ SUBROUTINE Calc_WriteOutput( p, AllOuts, y, m, ErrStat, ErrMsg )
! Sectional translational deflection (relative to the undeflected position) expressed in r
d = y%BldMotion%TranslationDisp(:, j_BldMotion) - m%u2%RootMotion%TranslationDisp(:,1)
d_ref = y%BldMotion%Position( :, j_BldMotion) - m%u2%RootMotion%Position( :,1)
temp_vec2 = d + d_ref - matmul( RootRelOrient, d_ref ) ! tip displacement
temp_vec2 = d + d_ref - MATMUL( RootRelOrient, d_ref ) ! tip displacement
temp_vec = MATMUL(m%u2%RootMotion%Orientation(:,:,1),temp_vec2)

AllOuts( NTDr( beta,1 ) ) = temp_vec(1)
Expand All @@ -1600,8 +1608,8 @@ SUBROUTINE Calc_WriteOutput( p, AllOuts, y, m, ErrStat, ErrMsg )
call LAPACK_DGEMM('N', 'T', 1.0_BDKi, y%BldMotion%RefOrientation(:,:,j_BldMotion), RootRelOrient, 0.0_BDKi, temp33_2, ErrStat2, ErrMsg2 )
call LAPACK_DGEMM('T', 'N', 1.0_BDKi, y%BldMotion%Orientation( :,:,j_BldMotion), temp33_2, 0.0_BDKi, temp33, ErrStat2, ErrMsg2 )
call BD_CrvExtractCrv(temp33,temp_vec2, ErrStat2, ErrMsg2) ! temp_vec2 = the Wiener-Milenkovic parameters of the node's angular/rotational defelctions
CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
temp_vec = MATMUL(m%u2%RootMotion%Orientation(:,:,1),temp_vec2) ! translate these parameters to the correct system for output

AllOuts( NRDr( beta,1 ) ) = temp_vec(1)
Expand Down Expand Up @@ -1759,9 +1767,9 @@ SUBROUTINE BD_PrintSum( p, x, m, RootName, ErrStat, ErrMsg )

WRITE (UnSu,'(A,1ES18.5)') 'Time increment:',p%dt

WRITE (UnSu,'(A,I4)' ) 'Maximum number of iterations in Newton-Ralphson solution:', p%niter
WRITE (UnSu,'(A,I4)' ) 'Maximum number of iterations in Newton-Raphson solution:', p%niter
WRITE (UnSu,'(A,1ES18.5)' ) 'Convergence parameter:', p%tol
WRITE (UnSu,'(A,I4)' ) 'Factorization frequency in Newton-Ralphson solution:', p%n_fact
WRITE (UnSu,'(A,I4)' ) 'Factorization frequency in Newton-Raphson solution:', p%n_fact

IF(p%quadrature .EQ. GAUSS_QUADRATURE) THEN
WRITE (UnSu,'(A)') 'Quadrature method: Gauss quadrature'
Expand Down Expand Up @@ -1806,6 +1814,13 @@ SUBROUTINE BD_PrintSum( p, x, m, RootName, ErrStat, ErrMsg )
WRITE(UnSu,'(I4,3ES18.5)') i,p%QuadPt(1:3,i+p%qp_indx_offset)
ENDDO

WRITE (UnSu,'(/,A)') 'Quadrature point initial rotation vectors'
WRITE (UnSu,'(A,1x,3(1x,A))') ' QP ',' WM_x ',' WM_y ',' WM_z '
WRITE (UnSu,'(A,1x,3(1x,A))') '----','-----------------','-----------------','-----------------'
DO i=1,size(p%Stif0_QP,3) !(note size(p%QuadPt,2) = size(p%Stif0_QP,3) + 2*p%qp_indx_offset)
WRITE(UnSu,'(I4,3ES18.5)') i,p%QuadPt(4:6,i+p%qp_indx_offset)
ENDDO

WRITE (UnSu,'(/,A)') 'Sectional stiffness and mass matrices at quadrature points (in IEC coordinates)'
DO i=1,size(p%Stif0_QP,3)
WRITE (UnSu,'(/,A,I4)') 'Quadrature point number: ',i
Expand Down Expand Up @@ -1853,7 +1868,8 @@ SUBROUTINE BD_PrintSum( p, x, m, RootName, ErrStat, ErrMsg )



if (p%analysis_type == BD_DYNAMIC_ANALYSIS) then

if (p%analysis_type == BD_DYNAMIC_ANALYSIS ) then
! we'll add mass and stiffness matrices in the first call to UpdateStates
m%Un_Sum = UnSu
else
Expand Down
Loading