Skip to content
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
83 changes: 83 additions & 0 deletions modules/beamdyn/tests/test_BD_ComputeIniNodalCrv.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
@test
subroutine test_BD_ComputeIniNodalCrv()
! test branches
! - simple rotation with known parameters: Pi on xaxis
! - 0 rotation
! - small rotation with baseline WM parameters calculated

use pFUnit_mod
use BeamDyn_Subs
use NWTC_Num
use test_tools

implicit none

real(BDKi), dimension(3,3) :: r
real(BDKi), dimension(3) :: test_wmparams, baseline_wmparams
real(BDKi) :: angle, param, n(3)
character(1024) :: testname
real(BDKi) :: tolerance
integer(IntKi) :: ErrStat
character :: ErrMsg

! initialize NWTC_Num constants
call SetConstants()

tolerance = 1e-14

! --------------------------------------------------------------------------
testname = "Tangent aligned with z-axis and 0 degree twist:"
n = (/ real(0.0, BDKi), real(0.0, BDKi), real(1.0, BDKi) /) ! tangent axis

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm surprised there were any issues with the original code for this line. I can see other lines were missing the _BDKi part, but I'm surprised that writing 0.0_BDKi was problematic.

angle = 0

! Baseline Wiener-Milenkovic parameters
baseline_wmparams = (/ 0.0, 0.0, 0.0 /)

call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg)

@assertEqual(0.0_BDKi, ErrStat, tolerance, testname)
@assertEqual(baseline_wmparams, test_wmparams, tolerance, testname)

! --------------------------------------------------------------------------
testname = "Tangent at 45 degree w.r.t. y-axis and 0 degree twist:"
n = (/ 1.0_BDKi/sqrt(2.0_BDKi), 0.0_BDKi, 1.0_BDKi/sqrt(2.0_BDKi) /) ! tangent axis
angle = 0.0_BDKi

! Baseline Wiener-Milenkovic parameters
param = 4*tan((Pi_D/4)/4)
baseline_wmparams = (/ real(0.0, BDKi), param, real(0.0, BDKi) /)

call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg)

@assertEqual(0.0_BDKi, ErrStat, tolerance, testname)
@assertEqual(baseline_wmparams, test_wmparams, tolerance, testname)

! --------------------------------------------------------------------------
testname = "Tangent at -45 degree w.r.t. x-axis and 0 degree twist:"
n = (/ 0.0_BDKi, 1.0_BDKi/sqrt(2.0_BDKi), 1.0_BDKi/sqrt(2.0_BDKi) /) ! tangent axis
angle = 0.0_BDKi

! Baseline Wiener-Milenkovic parameters
param = 4*tan((-Pi_D/4)/4)
baseline_wmparams = (/ param, real(0.0, BDKi), real(0.0, BDKi) /)

call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg)

@assertEqual(0.0_BDKi, ErrStat, tolerance, testname)
@assertEqual(baseline_wmparams, test_wmparams, tolerance, testname)

! --------------------------------------------------------------------------
testname = "Tangent along z-axis with 45 degree twist:"
n = (/ real(0.0, BDKi), real(0.0, BDKi), 1.0_BDKi /) ! tangent axis
angle = 45.0_BDKi

! Baseline Wiener-Milenkovic parameters
param = 4*tan((Pi_D/4)/4)
baseline_wmparams = (/ real(0.0, BDKi), real(0.0, BDKi), param /)

call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg)

@assertEqual(0.0_BDKi, ErrStat, tolerance, testname)
@assertEqual(baseline_wmparams, test_wmparams, tolerance, testname)

end subroutine test_BD_ComputeIniNodalCrv
1 change: 1 addition & 0 deletions unit_tests/beamdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ include_directories(

set(testlist
test_tools
test_BD_ComputeIniNodalCrv
test_BD_CrvCompose
test_BD_CheckRotMat
test_BD_CrvExtractCrv
Expand Down