h2lib-tests 13.1.3101__py3-none-any.whl → 13.1.3102__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h2lib_tests/test_ellipsys_couplings.py +27 -6
- h2lib_tests/test_h2rotor.py +12 -11
- h2lib_tests/test_mpi.py +2 -2
- {h2lib_tests-13.1.3101.dist-info → h2lib_tests-13.1.3102.dist-info}/METADATA +2 -2
- {h2lib_tests-13.1.3101.dist-info → h2lib_tests-13.1.3102.dist-info}/RECORD +7 -7
- {h2lib_tests-13.1.3101.dist-info → h2lib_tests-13.1.3102.dist-info}/WHEEL +0 -0
- {h2lib_tests-13.1.3101.dist-info → h2lib_tests-13.1.3102.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,9 @@
|
|
1
|
-
from h2lib._h2lib import MultiH2Lib, H2LibThread
|
1
|
+
from h2lib._h2lib import MultiH2Lib, H2LibThread, H2Lib
|
2
2
|
import numpy as np
|
3
3
|
from wetb.hawc2.htc_file import HTCFile
|
4
4
|
from numpy import newaxis as na
|
5
5
|
from h2lib_tests.test_files import tfp
|
6
|
+
import pytest
|
6
7
|
|
7
8
|
|
8
9
|
class Ellipsys():
|
@@ -23,17 +24,38 @@ class Ellipsys():
|
|
23
24
|
pass
|
24
25
|
|
25
26
|
|
27
|
+
def test_set_aerosections_windspeeds_without_init(capfd):
|
28
|
+
|
29
|
+
with H2Lib(suppress_output=0) as h2:
|
30
|
+
el = Ellipsys()
|
31
|
+
htc = HTCFile(tfp + 'DTU_10_MW/htc/DTU_10MW_RWT_no_aerodrag.htc')
|
32
|
+
htc.set_name(f'wt0')
|
33
|
+
htc.save()
|
34
|
+
|
35
|
+
h2.init(htc_path=f'htc/wt0.htc', model_path=tfp + 'DTU_10_MW')
|
36
|
+
wt_pos = np.array([0, 0, 0])
|
37
|
+
|
38
|
+
el.step()
|
39
|
+
pos_gl_xyz = np.array(h2.get_aerosections_position(), order='F') + wt_pos[na, na, :]
|
40
|
+
uvw = np.asfortranarray(el.get_uvw(pos_gl_xyz))
|
41
|
+
|
42
|
+
with pytest.raises(Exception, match='H2LibThread process died before or while executing set_aerosections_windspeed'):
|
43
|
+
h2.set_aerosections_windspeed(uvw)
|
44
|
+
out = capfd.readouterr().out
|
45
|
+
assert "Please call init_ad or init_al be" in out
|
46
|
+
|
47
|
+
|
26
48
|
def test_ellipsys_dummy_workflow_1wt():
|
27
49
|
|
28
50
|
N = 1
|
29
|
-
with MultiH2Lib(N, suppress_output=
|
51
|
+
with MultiH2Lib(N, suppress_output=0) as h2:
|
30
52
|
el = Ellipsys()
|
31
53
|
htc = HTCFile(tfp + 'DTU_10_MW/htc/DTU_10MW_RWT_no_aerodrag.htc')
|
32
54
|
for i in range(N):
|
33
55
|
htc.set_name(f'wt{i}')
|
34
56
|
htc.save()
|
35
57
|
|
36
|
-
h2.
|
58
|
+
h2.init_AD(htc_path=f'htc/wt0.htc', model_path=tfp + 'DTU_10_MW', tiploss_shen_c2=28)
|
37
59
|
wt_pos = np.array([0, 0, 0])
|
38
60
|
|
39
61
|
while True:
|
@@ -51,15 +73,14 @@ def test_ellipsys_dummy_workflow_1wt():
|
|
51
73
|
def test_ellipsys_dummy_workflow():
|
52
74
|
|
53
75
|
N = 4
|
54
|
-
with MultiH2Lib(N, suppress_output=
|
76
|
+
with MultiH2Lib(N, suppress_output=1) as h2:
|
55
77
|
el = Ellipsys()
|
56
78
|
htc = HTCFile(tfp + 'DTU_10_MW/htc/DTU_10MW_RWT_no_aerodrag.htc')
|
57
79
|
for i in range(N):
|
58
80
|
htc.set_name(f'wt{i}')
|
59
81
|
htc.save()
|
60
82
|
|
61
|
-
h2.
|
62
|
-
model_path=tfp + 'DTU_10_MW')
|
83
|
+
h2.init_AD(htc_path=[f'htc/wt{i}.htc' for i in range(N)], model_path=tfp + 'DTU_10_MW', tiploss_shen_c2=28)
|
63
84
|
wt_pos = np.array([[0, 0, 0], [0, 500, 0], [0, 1000, 0], [0, 1500, 0]])
|
64
85
|
|
65
86
|
while True:
|
h2lib_tests/test_h2rotor.py
CHANGED
@@ -14,7 +14,7 @@ import h5py
|
|
14
14
|
|
15
15
|
|
16
16
|
def get_h2(htc_path='htc/DTU_10MW_RWT.htc'):
|
17
|
-
h2 = H2Lib(suppress_output=
|
17
|
+
h2 = H2Lib(suppress_output=1)
|
18
18
|
h2.read_input(htc_path=htc_path, model_path=tfp + 'DTU_10_MW')
|
19
19
|
return h2
|
20
20
|
|
@@ -123,14 +123,14 @@ def test_rotor_avg_windspeed():
|
|
123
123
|
|
124
124
|
|
125
125
|
def test_aerosections():
|
126
|
-
plot =
|
126
|
+
plot = 0
|
127
127
|
h2 = get_h2(htc_path='htc/DTU_10MW_RWT_no_aerodrag.htc')
|
128
128
|
# blade 1, global coo, r>30
|
129
129
|
pos_ids = [h2.add_sensor(f'aero position 3 1 {xyz} 30')[0] for xyz in [1, 2, 3]]
|
130
130
|
wsp_ids = [h2.add_sensor(f'aero windspeed 3 1 {xyz} 30')[0] for xyz in [1, 2, 3]]
|
131
131
|
frc_ids = [h2.add_sensor(f'aero secforce 1 {xyz} 30 3')[0] for xyz in [1, 2, 3]]
|
132
132
|
mom_ids = [h2.add_sensor(f'aero secmoment 1 {xyz} 30 3')[0] for xyz in [1, 2, 3]]
|
133
|
-
h2.
|
133
|
+
h2.init_AL(epsilon_smearing=5)
|
134
134
|
|
135
135
|
a = h2.get_aerosections_position()
|
136
136
|
if plot:
|
@@ -154,7 +154,7 @@ def test_aerosections():
|
|
154
154
|
npt.assert_array_almost_equal(a[0, i], [h2.get_sensor_values(id) for id in pos_ids])
|
155
155
|
uvw = a * 0
|
156
156
|
uvw[:, :, 0] = 6
|
157
|
-
uvw
|
157
|
+
h2.set_aerosections_windspeed(uvw)
|
158
158
|
h2.run(3)
|
159
159
|
npt.assert_array_equal(h2.get_sensor_values(wsp_ids), [0, 6, 0])
|
160
160
|
npt.assert_array_almost_equal(h2.get_sensor_values(frc_ids), h2.get_aerosections_forces()[0, i] / 1000)
|
@@ -165,10 +165,11 @@ def test_aerosections():
|
|
165
165
|
plt.figure()
|
166
166
|
plt.plot(frc_before[:, :, 1].T)
|
167
167
|
|
168
|
-
|
169
|
-
h2.set_aerosections_windspeed(uvw)
|
170
|
-
# rotor avg freestream wsp unknown after setting wsp incl induction at aero section
|
168
|
+
# rotor avg freestream wsp unknown after init_AD
|
171
169
|
npt.assert_array_equal(h2.get_rotor_avg_wsp(), [np.nan, np.nan, np.nan])
|
170
|
+
uvw[0, i, 0] = 12
|
171
|
+
h2.set_aerosections_windspeed(uvw)
|
172
|
+
|
172
173
|
h2.step()
|
173
174
|
frc_after = h2.get_aerosections_forces()
|
174
175
|
mom_after = h2.get_aerosections_moments()
|
@@ -180,7 +181,7 @@ def test_aerosections():
|
|
180
181
|
assert frc_before[0, i, 1] * 2 < frc_after[0, i, 1]
|
181
182
|
|
182
183
|
# rest is similar (within 7N/m, max Fxyz along blade is [331 , 378, 288]
|
183
|
-
frc_after[0, i, :] = frc_before[0, i, :]
|
184
|
+
frc_after[0, i, :] = frc_before[0, i, :] # reset frc at 30m to previous value. Now everything is similar
|
184
185
|
npt.assert_allclose(frc_before, frc_after, atol=7)
|
185
186
|
h2.close()
|
186
187
|
|
@@ -235,7 +236,7 @@ def test_compare_aerosection_coupling():
|
|
235
236
|
|
236
237
|
dtu10.set_name('tmp1')
|
237
238
|
dtu10.save()
|
238
|
-
with H2Lib(suppress_output=
|
239
|
+
with H2Lib(suppress_output=1) as h2:
|
239
240
|
h2.init(dtu10.filename, dtu10.modelpath)
|
240
241
|
h2.run(T)
|
241
242
|
|
@@ -244,8 +245,8 @@ def test_compare_aerosection_coupling():
|
|
244
245
|
dtu10.set_name('tmp2')
|
245
246
|
dtu10.save()
|
246
247
|
|
247
|
-
with H2Lib(suppress_output=
|
248
|
-
h2.
|
248
|
+
with H2Lib(suppress_output=1) as h2:
|
249
|
+
h2.init_AD(htc_path=dtu10.filename, model_path=dtu10.modelpath, tiploss_method=0)
|
249
250
|
last_pos_gl_xyz = np.array(h2.get_aerosections_position(), order='F')
|
250
251
|
while h2.time < T:
|
251
252
|
pos_gl_xyz = np.array(h2.get_aerosections_position(), order='F')
|
h2lib_tests/test_mpi.py
CHANGED
@@ -146,7 +146,7 @@ def test_ellipsys_mpi_dummy_workflow():
|
|
146
146
|
h2.read_input(htc_path=get_htc_lst(),
|
147
147
|
model_path=tfp + 'DTU_10_MW')
|
148
148
|
wt_pos = np.array([[0, 0, 0], [0, 500, 0], [0, 1000, 0], [0, 1500, 0]])
|
149
|
-
h2.
|
149
|
+
h2.init_AD()
|
150
150
|
t = 0
|
151
151
|
while True:
|
152
152
|
t = el.step()
|
@@ -176,7 +176,7 @@ def test_ellipsys_mpi_dummy_workflow_collective():
|
|
176
176
|
h2.read_input(htc_path=get_htc_lst(),
|
177
177
|
model_path=tfp + 'DTU_10_MW')
|
178
178
|
wt_pos = np.array([[0, 0, 0], [0, 500, 0], [0, 1000, 0], [0, 1500, 0]])
|
179
|
-
h2.
|
179
|
+
h2.init_AD()
|
180
180
|
t = 0
|
181
181
|
while True:
|
182
182
|
t = el.step()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: h2lib-tests
|
3
|
-
Version: 13.1.
|
4
|
-
Summary: Tests and test_files for test h2lib (13.1.31+
|
3
|
+
Version: 13.1.3102
|
4
|
+
Summary: Tests and test_files for test h2lib (13.1.31+5-g08eea40)
|
5
5
|
Download-URL:
|
6
6
|
Author: Mads M Pedersen
|
7
7
|
Author-email:
|
@@ -2,11 +2,11 @@ h2lib_tests/__init__.py,sha256=VjSqfGg8BzdmSjfSFhJh4hZbYZ_cME7xp9EWFKHQphA,61
|
|
2
2
|
h2lib_tests/conftest.py,sha256=DAxRUsOP7-3-JUTglMSuyr1qcsdrqeKEDerEtenL0lA,14753
|
3
3
|
h2lib_tests/dtu10mw.py,sha256=a7SXfyDwDQPastYKb5CgghOQcYfgO1eTwGrd-H3Enok,4374
|
4
4
|
h2lib_tests/test_calc.py,sha256=VNLfr2J9R2Jy9xTbdZ9dfbQ4dCwr7H7nbZRI3yP69fQ,2152
|
5
|
-
h2lib_tests/test_ellipsys_couplings.py,sha256=
|
5
|
+
h2lib_tests/test_ellipsys_couplings.py,sha256=cAo036WqDkwksCX0EXdUUoJ9mJHjpkUPuIlKLW7GnzY,3284
|
6
6
|
h2lib_tests/test_h2lib.py,sha256=opgVOkZWOD9CrnTDfwRrBaD-weBsNnutm6FeOijDa88,14197
|
7
|
-
h2lib_tests/test_h2rotor.py,sha256=
|
7
|
+
h2lib_tests/test_h2rotor.py,sha256=4P5bUGvwYDl8Z9hVNP_SXKa79DWhsA-ptpp0v0rT9ow,11309
|
8
8
|
h2lib_tests/test_lin.py,sha256=KujYIy9YXTo-uxi_umRWIWZwcHu0oH8GyeVgMcMCq0o,6383
|
9
|
-
h2lib_tests/test_mpi.py,sha256=
|
9
|
+
h2lib_tests/test_mpi.py,sha256=8bMeukbWboijMgWLJIIu3Pn0QtaDadOGhhL099MfMls,6990
|
10
10
|
h2lib_tests/test_multiprocessinterface.py,sha256=h2o4havtK6IuMXsplNjGUa3VxOnbpEYGxdrrAKQilj0,1470
|
11
11
|
h2lib_tests/test_static_solver.py,sha256=ckzcBAuVge5V5tdrac4PPYxrH5TheNTUc3PKksbB89A,7426
|
12
12
|
h2lib_tests/test_topology_h2lib.py,sha256=VjJ1SUBHRHwuSn0EPI6KGzwAULZbPzA39rXdDGXyxkk,11510
|
@@ -89,7 +89,7 @@ h2lib_tests/test_files/minimal/res/minimal_mann_turb.hdf5,sha256=Q3cs3bZyplZjBpo
|
|
89
89
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_u,sha256=byiorJmXDL6uKFbyfXthHTjJdm6ELvLR2lS202KrhRI,1048576
|
90
90
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_v,sha256=cxK5Rfgfm3gyJsEYi_KlmYY8DIIl_G0aizN2jt18Glc,1048576
|
91
91
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_w,sha256=xs61jAwhP3fIR1P5Oa8ovEt2baLoF8uCNs6pKIT8L4o,1048576
|
92
|
-
h2lib_tests-13.1.
|
93
|
-
h2lib_tests-13.1.
|
94
|
-
h2lib_tests-13.1.
|
95
|
-
h2lib_tests-13.1.
|
92
|
+
h2lib_tests-13.1.3102.dist-info/METADATA,sha256=FgPhvGVItQe7EYP_eXjmrMXOnxfT3yXxTI4ALJgN99I,419
|
93
|
+
h2lib_tests-13.1.3102.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
94
|
+
h2lib_tests-13.1.3102.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
|
95
|
+
h2lib_tests-13.1.3102.dist-info/RECORD,,
|
File without changes
|
File without changes
|