-
Notifications
You must be signed in to change notification settings - Fork 531
Add unit tests for BD_ComputeIniNodalCrv #636
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
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
_BDKipart, but I'm surprised that writing0.0_BDKiwas problematic.