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

Lin tests: increase out precision, error printing full filename, add SD linearization test #2055

Merged
merged 3 commits into from
Feb 28, 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
1 change: 1 addition & 0 deletions reg_tests/CTestList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ of_regression_linear("5MW_Land_BD_Linear" "openfast;linear;beamdyn;ser
of_regression_linear("5MW_Land_BD_Linear_Aero" "openfast;linear;beamdyn;servodyn;aerodyn")
of_regression_linear("5MW_OC4Semi_Linear" "openfast;linear;hydrodyn;servodyn;map")
of_regression_linear("5MW_OC4Semi_MD_Linear" "openfast;linear;hydrodyn;servodyn;moordyn")
of_regression_linear("5MW_OC3Mnpl_Linear" "openfast;linear;hydrodyn;servodyn;moordyn")
of_regression_linear("StC_test_OC4Semi_Linear_Nac" "openfast;linear;servodyn;stc")
of_regression_linear("StC_test_OC4Semi_Linear_Tow" "openfast;linear;servodyn;stc")
of_regression_linear("5MW_OC3Spar_Linear" "openfast;linear;map;hydrodyn")
Expand Down
23 changes: 14 additions & 9 deletions reg_tests/executeOpenfastLinearRegressionCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ def indent(msg, sindent='\t'):
for i, f in enumerate(localOutFiles):
local_file = os.path.join(testBuildDirectory, f)
baseline_file = os.path.join(targetOutputDirectory, f)
# Set a prefix for all errors to identify where it comes from
basename = os.path.splitext(os.path.basename(local_file))[0]
ext2 = os.path.splitext(basename)[1][1:] #+'.lin' # '.1' or '.AD' '.BD'
errPrefix = CasePrefix[:-1]+ext2+': '

if verbose:
print(CasePrefix+'ref:', baseline_file)
print(CasePrefix+'new:', local_file)
print(errPrefix+'ref:', baseline_file)
print(errPrefix+'new:', local_file)

# verify both files have the same number of lines
local_file_line_count = file_line_count(local_file)
Expand Down Expand Up @@ -228,19 +233,19 @@ def indent(msg, sindent='\t'):
v_loc = np.diag(Lambda)

if verbose:
print(CasePrefix+'val_ref:', v_bas[:7])
print(CasePrefix+'val_new:', v_loc[:7])
print(errPrefix+'val_ref:', v_bas[:7])
print(errPrefix+'val_new:', v_loc[:7])
try:
np.testing.assert_allclose(v_bas[:10], v_loc[:10], rtol=rtol_f, atol=atol_f)
except Exception as e:
raise Exception('Failed to compare A-matrix frequencies\n\tLinfile: {}.\n\tException: {}'.format(local_file, indent(e.args[0])))
else:

#if verbose:
print(CasePrefix+'freq_ref:', np.around(freq_bas[:10] ,5), '[Hz]')
print(CasePrefix+'freq_new:', np.around(freq_loc[:10] ,5), '[Hz]')
print(CasePrefix+'damp_ref:', np.around(zeta_bas[:10]*100,5), '[%]')
print(CasePrefix+'damp_new:', np.around(zeta_loc[:10]*100,5), '[%]')
print(errPrefix+'freq_ref:', np.around(freq_bas[:10] ,5), '[Hz]')
print(errPrefix+'freq_new:', np.around(freq_loc[:10] ,5), '[Hz]')
print(errPrefix+'damp_ref:', np.around(zeta_bas[:10]*100,5), '[%]')
print(errPrefix+'damp_new:', np.around(zeta_loc[:10]*100,5), '[%]')

try:
np.testing.assert_allclose(freq_loc[:10], freq_bas[:10], rtol=rtol_f, atol=atol_f)
Expand All @@ -266,7 +271,7 @@ def indent(msg, sindent='\t'):
if k not in KEYS or v is None:
continue
if verbose:
print(CasePrefix+'key:', k)
print(errPrefix+'key:', k)
# Arrays
Mloc=np.atleast_2d(floc[k])
Mbas=np.atleast_2d(fbas[k])
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 40 files
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.AD.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD1.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD2.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD3.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.ED.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.IfW.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.SrvD.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.lin
+ glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.outb
+976 −976 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.1.AD.lin
+242 −242 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.1.ED.lin
+14 −14 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.1.IfW.lin
+5 −5 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.1.SrvD.lin
+1,229 −1,229 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.1.lin
+1 −1 glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.fst
+ glue-codes/openfast/5MW_Land_Linear_Aero/5MW_Land_Linear_Aero.outb
+346 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.1.lin
+203 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.ED.sum
+387 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.SD.sum.yaml
+71 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.fst
+9 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.out
+ glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.outb
+88 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/5MW_OC3Mnpl_Linear.sum
+135 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/NRELOffshrBsline5MW_OC3Monopile_ElastoDyn.dat
+54 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/NRELOffshrBsline5MW_OC3Monopile_ElastoDyn_Tower.dat
+99 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/NRELOffshrBsline5MW_OC3Monopile_SubDyn.dat
+1 −0 glue-codes/openfast/5MW_OC3Mnpl_Linear/README.md
+586 −586 glue-codes/openfast/5MW_OC3Spar_Linear/5MW_OC3Spar_Linear.1.lin
+1 −1 glue-codes/openfast/5MW_OC3Spar_Linear/5MW_OC3Spar_Linear.fst
+1 −1 glue-codes/openfast/5MW_OC4Semi_Linear/5MW_OC4Semi_Linear.fst
+1 −1 glue-codes/openfast/Fake5MW_AeroLin_B1_UA4_DBEMT3/Fake5MW_AeroLin_B1_UA4_DBEMT3.fst
+318 −318 glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.1.AD.lin
+141 −141 glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.1.ED.lin
+62 −62 glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.1.IfW.lin
+510 −510 glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.1.lin
+1 −1 glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.fst
+ glue-codes/openfast/Fake5MW_AeroLin_B3_UA6/Fake5MW_AeroLin_B3_UA6.outb
+1 −1 glue-codes/openfast/StC_test_OC4Semi_Linear_Nac/StC_test_OC4Semi_Linear_Nac.fst
+1 −1 glue-codes/openfast/StC_test_OC4Semi_Linear_Tow/StC_test_OC4Semi_Linear_Tow.fst
+1 −1 glue-codes/openfast/WP_Stationary_Linear/WP_Stationary_Linear.fst