h2lib-tests 13.1.506__py3-none-any.whl → 13.1.1701__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.
@@ -4,41 +4,6 @@ from numpy import testing as npt
4
4
  from h2lib_tests.test_files import tfp
5
5
  import numpy as np
6
6
  import pytest
7
- from .test_write_htc import (
8
- write_dtu10mw_only_tower,
9
- write_dtu10mw_only_tower_rotated,
10
- write_dtu10mw_only_tower_encrypted
11
- )
12
-
13
-
14
- @pytest.fixture(scope="module")
15
- def h2_dtu_10mw_only_tower(write_dtu10mw_only_tower):
16
- h2 = H2Lib(suppress_output=True)
17
- model_path = f"{tfp}DTU_10_MW/"
18
- htc_path = "htc/DTU_10MW_RWT_only_tower.htc"
19
- h2.init(htc_path=htc_path, model_path=model_path)
20
- yield h2
21
- h2.close()
22
-
23
-
24
- @pytest.fixture(scope="module")
25
- def h2_dtu_10mw_only_tower_rotated(write_dtu10mw_only_tower_rotated):
26
- h2 = H2Lib(suppress_output=True)
27
- model_path = f"{tfp}DTU_10_MW/"
28
- htc_path = "htc/DTU_10MW_RWT_only_tower_rotated.htc"
29
- h2.init(htc_path=htc_path, model_path=model_path)
30
- yield h2
31
- h2.close()
32
-
33
-
34
- @pytest.fixture(scope="module")
35
- def h2_dtu_10mw_only_tower_encrypted(write_dtu10mw_only_tower_encrypted):
36
- h2 = H2Lib(suppress_output=True)
37
- model_path = f"{tfp}DTU_10_MW/"
38
- htc_path = "htc/DTU_10MW_RWT_only_tower_encrypted.htc"
39
- h2.init(htc_path=htc_path, model_path=model_path)
40
- yield h2
41
- h2.close()
42
7
 
43
8
 
44
9
  def test_number_of_bodies_and_constraints(
@@ -74,7 +39,9 @@ def test_get_timoshenko_location(
74
39
  h2_dtu_10mw_only_tower,
75
40
  ):
76
41
  # Test first element.
77
- l, r1, r12, tes = h2_dtu_10mw_only_tower.get_timoshenko_location(ibdy=0, ielem=0)
42
+ l, r1, r12, tes = h2_dtu_10mw_only_tower.get_timoshenko_location(
43
+ ibdy=0, ielem=0
44
+ )
78
45
  assert l - 11.5 < 1e-14
79
46
  npt.assert_array_equal(r1, np.array([0.0, 0.0, 0]))
80
47
  npt.assert_array_almost_equal_nulp(r12, np.array([0.0, 0.0, -11.5]))
@@ -84,10 +51,14 @@ def test_get_timoshenko_location(
84
51
  )
85
52
 
86
53
  # Test last element.
87
- l, r1, r12, tes = h2_dtu_10mw_only_tower.get_timoshenko_location(ibdy=2, ielem=3)
54
+ l, r1, r12, tes = h2_dtu_10mw_only_tower.get_timoshenko_location(
55
+ ibdy=2, ielem=3
56
+ )
88
57
  assert l - 12.13 < 1e-14
89
58
  npt.assert_array_almost_equal_nulp(r1, np.array([0.0, 0.0, -34.5]))
90
- npt.assert_array_almost_equal_nulp(r12, np.array([0.0, 0.0, -12.13]), nulp=3)
59
+ npt.assert_array_almost_equal_nulp(
60
+ r12, np.array([0.0, 0.0, -12.13]), nulp=3
61
+ )
91
62
  npt.assert_array_equal(
92
63
  tes,
93
64
  np.array([[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]]),
@@ -112,7 +83,9 @@ def test_get_timoshenko_location_encrypted(
112
83
  h2_dtu_10mw_only_tower_encrypted,
113
84
  ):
114
85
  with pytest.raises(RuntimeError, match="STRUCTURE_IS_CONFIDENTIAL"):
115
- h2_dtu_10mw_only_tower_encrypted.get_timoshenko_location(ibdy=0, ielem=0)
86
+ h2_dtu_10mw_only_tower_encrypted.get_timoshenko_location(
87
+ ibdy=0, ielem=0
88
+ )
116
89
 
117
90
 
118
91
  def test_get_body_rotation_tensor_1(h2_dtu_10mw_only_tower):
@@ -141,3 +114,162 @@ def test_get_body_rotation_tensor_body_does_not_exist(h2_dtu_10mw_only_tower):
141
114
  def test_get_body_rotation_tensor_encrypted(h2_dtu_10mw_only_tower_encrypted):
142
115
  with pytest.raises(RuntimeError, match="STRUCTURE_IS_CONFIDENTIAL"):
143
116
  h2_dtu_10mw_only_tower_encrypted.get_body_rotation_tensor(ibdy=0)
117
+
118
+
119
+ def test_set_orientation_base_not_found(h2_dtu_10mw_only_tower):
120
+ with pytest.raises(ValueError, match="MAIN_BODY_NOT_FOUND"):
121
+ h2_dtu_10mw_only_tower.set_orientation_base(main_body="blade")
122
+
123
+
124
+ def test_set_orientation_base_1(
125
+ h2_dtu_10mw_only_tower, h2_dtu_10mw_only_tower_rotated
126
+ ):
127
+ # Start from h2_dtu_10mw_only_tower and rotate the base.
128
+ # See if it matches h2_dtu_10mw_only_tower_rotated.
129
+ h2_dtu_10mw_only_tower.set_orientation_base(
130
+ main_body="tower", mbdy_eulerang_table=np.array([30.0, 0.0, 0.0])
131
+ )
132
+ amat_desired = h2_dtu_10mw_only_tower_rotated.get_body_rotation_tensor(
133
+ ibdy=0
134
+ )
135
+ amat_actual = h2_dtu_10mw_only_tower.get_body_rotation_tensor(ibdy=0)
136
+ npt.assert_array_almost_equal_nulp(amat_actual, amat_desired)
137
+ # Reset orientation.
138
+ h2_dtu_10mw_only_tower.set_orientation_base(main_body="tower")
139
+
140
+
141
+ def test_set_orientation_base_with_reset_orientation(
142
+ h2_dtu_10mw_only_tower_rotated,
143
+ ):
144
+ h2_dtu_10mw_only_tower_rotated.set_orientation_base(
145
+ main_body="tower", reset_orientation=True
146
+ )
147
+ amat_actual = h2_dtu_10mw_only_tower_rotated.get_body_rotation_tensor(
148
+ ibdy=0
149
+ )
150
+ npt.assert_array_almost_equal_nulp(amat_actual, np.eye(3))
151
+ # Reset orientation.
152
+ h2_dtu_10mw_only_tower_rotated.set_orientation_base(
153
+ main_body="tower", mbdy_eulerang_table=np.array([30.0, 0.0, 0.0])
154
+ )
155
+
156
+
157
+ def test_set_orientation_base_without_reset_orientation(
158
+ h2_dtu_10mw_only_tower_rotated,
159
+ ):
160
+ h2_dtu_10mw_only_tower_rotated.set_orientation_base(
161
+ main_body="tower",
162
+ mbdy_eulerang_table=np.array([-30.0, 0.0, 0.0]),
163
+ reset_orientation=False,
164
+ )
165
+ amat_actual = h2_dtu_10mw_only_tower_rotated.get_body_rotation_tensor(
166
+ ibdy=0
167
+ )
168
+ npt.assert_array_almost_equal_nulp(amat_actual, np.eye(3))
169
+ # Reset orientation.
170
+ h2_dtu_10mw_only_tower_rotated.set_orientation_base(
171
+ main_body="tower", mbdy_eulerang_table=np.array([30.0, 0.0, 0.0])
172
+ )
173
+
174
+
175
+ def test_set_orientation_base_speed(
176
+ h2_dtu_10mw_only_blade
177
+ ):
178
+ # Set speed.
179
+ h2_dtu_10mw_only_blade.set_orientation_base(
180
+ main_body="blade1",
181
+ reset_orientation=False,
182
+ mbdy_ini_rotvec_d1=np.array([0.0, 1.0, 0.0, 1.0]),
183
+ )
184
+ # TODO: check against h2_dtu_10mw_only_blade_rotate_base.
185
+ # Reset speed.
186
+ h2_dtu_10mw_only_blade.set_orientation_base(
187
+ main_body="blade1",
188
+ reset_orientation=False,
189
+ )
190
+
191
+
192
+ def test_set_orientation_relative_main_body_not_found(h2_dtu_10mw_only_blade_rotate_relative):
193
+ h2_dtu_10mw_only_blade_rotate_relative.stop_on_error(False)
194
+ with pytest.raises(ValueError, match="MAIN_BODY_NOT_FOUND"):
195
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative("hub1", "last", "blade", 0)
196
+
197
+
198
+ def test_set_orientation_relative_rot_not_found(h2_dtu_10mw_only_blade_rotate_relative):
199
+ with pytest.raises(ValueError, match="RELATIVE_ROTATION_NOT_FOUND"):
200
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative("hub1", "last", "blade1", "last")
201
+
202
+
203
+ def test_set_orientation_relative_reset(
204
+ h2_dtu_10mw_only_blade_rotate_relative,
205
+ ):
206
+ # Reset orientation.
207
+ # Now the blade is aligned with the hub, which is vertical.
208
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative(
209
+ main_body_1="hub1",
210
+ node_1="last",
211
+ main_body_2="blade1",
212
+ node_2=0,
213
+ reset_orientation=True,
214
+ )
215
+ # Get orientation of blade root.
216
+ amat_actual = (
217
+ h2_dtu_10mw_only_blade_rotate_relative.get_body_rotation_tensor(ibdy=1)
218
+ )
219
+ # It must be the same as the hub.
220
+ amat_desired = (
221
+ h2_dtu_10mw_only_blade_rotate_relative.get_body_rotation_tensor(ibdy=0)
222
+ )
223
+ npt.assert_array_almost_equal_nulp(amat_actual, amat_desired)
224
+ # This matches a rotation around x by 180 deg.
225
+ # angle = np.deg2rad(180.0)
226
+ # s = np.sin(angle)
227
+ # c = np.cos(angle)
228
+ # amat_test = np.array(
229
+ # [[1.0, 0.0, 0.0], [0.0, c, -s], [0.0, s, c]],
230
+ # )
231
+ # Reset to original value.
232
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative(
233
+ main_body_1="hub1",
234
+ node_1="last",
235
+ main_body_2="blade1",
236
+ node_2=0,
237
+ mbdy2_eulerang_table=np.array([-90.0, 0.0, 0.0]),
238
+ reset_orientation=True,
239
+ mbdy2_ini_rotvec_d1=np.array([0.0, 1.0, 0.0, 1.0]),
240
+ )
241
+
242
+
243
+ def test_set_orientation_relative_2(
244
+ h2_dtu_10mw_only_blade_rotate_relative,
245
+ ):
246
+ # Get orientation of blade root.
247
+ amat_desired = (
248
+ h2_dtu_10mw_only_blade_rotate_relative.get_body_rotation_tensor(ibdy=1)
249
+ )
250
+ # Change orientation a few times.
251
+ rng = np.random.default_rng(seed=123)
252
+ for _ in range(5):
253
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative(
254
+ main_body_1="hub1",
255
+ node_1="last",
256
+ main_body_2="blade1",
257
+ node_2=0,
258
+ mbdy2_eulerang_table=rng.uniform(0.0, 360.0, (7, 3)),
259
+ reset_orientation=0,
260
+ )
261
+ # Reset to original value.
262
+ h2_dtu_10mw_only_blade_rotate_relative.set_orientation_relative(
263
+ main_body_1="hub1",
264
+ node_1="last",
265
+ main_body_2="blade1",
266
+ node_2=0,
267
+ mbdy2_eulerang_table=np.array([-90.0, 0.0, 0.0]),
268
+ reset_orientation=True,
269
+ mbdy2_ini_rotvec_d1=np.array([0.0, 1.0, 0.0, 1.0]),
270
+ )
271
+ # Check.
272
+ amat_actual = (
273
+ h2_dtu_10mw_only_blade_rotate_relative.get_body_rotation_tensor(ibdy=1)
274
+ )
275
+ npt.assert_array_almost_equal_nulp(amat_actual, amat_desired)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: h2lib-tests
3
- Version: 13.1.506
4
- Summary: Tests and test_files for test h2lib (13.1.8)
3
+ Version: 13.1.1701
4
+ Summary: Tests and test_files for test h2lib (13.1.17)
5
5
  Download-URL:
6
6
  Author: Mads M Pedersen
7
7
  Author-email:
@@ -13,4 +13,3 @@ Requires-Dist: pytest-cov
13
13
  Requires-Dist: hipersim
14
14
  Requires-Dist: wetb
15
15
  Requires-Dist: h2lib
16
-
@@ -1,14 +1,15 @@
1
1
  h2lib_tests/__init__.py,sha256=VjSqfGg8BzdmSjfSFhJh4hZbYZ_cME7xp9EWFKHQphA,61
2
+ h2lib_tests/conftest.py,sha256=uJrYYp-R7bVpBhfdzJH0CUrshS-S1_hAzST36JJZNbo,14559
2
3
  h2lib_tests/dtu10mw.py,sha256=a7SXfyDwDQPastYKb5CgghOQcYfgO1eTwGrd-H3Enok,4374
3
4
  h2lib_tests/test_calc.py,sha256=VNLfr2J9R2Jy9xTbdZ9dfbQ4dCwr7H7nbZRI3yP69fQ,2152
4
- h2lib_tests/test_ellipsys_couplings.py,sha256=69I_2h_PMfuIUgxnlLp_6bkS5IEpWMWnnPV1sRrWEp0,2399
5
- h2lib_tests/test_h2lib.py,sha256=ZKp8pfQQpCUQ7IBXypTmvewbJwTQowSiCEt6t4R9TgY,13384
6
- h2lib_tests/test_h2rotor.py,sha256=kaE9AFDYSPaMFSgBAbeegd7-l6Z_4_BsQaWie0k32q4,6210
7
- h2lib_tests/test_mpi.py,sha256=emBgXRAvvFFOsVrAziiQCUZvEF9HS5Wc-x4KqqltQP0,6835
5
+ h2lib_tests/test_ellipsys_couplings.py,sha256=GUvO43QF2YKxXby7eoBObv6Iu0rgMhtOXGcuCHO2JtM,2424
6
+ h2lib_tests/test_h2lib.py,sha256=opgVOkZWOD9CrnTDfwRrBaD-weBsNnutm6FeOijDa88,14197
7
+ h2lib_tests/test_h2rotor.py,sha256=SP4NTByJGJDc9yezR9QdijYlsJjMJ4BwItbhksijL1U,10597
8
+ h2lib_tests/test_lin.py,sha256=FxuDvPuu1MjWE4B7dIWC3qR-9NtjqodGPO1aurUDBwY,6362
9
+ h2lib_tests/test_mpi.py,sha256=sDiUMnZ5j-3y7fOpUy5-s624guTejKwlP-NHRZet3iY,6847
8
10
  h2lib_tests/test_multiprocessinterface.py,sha256=h2o4havtK6IuMXsplNjGUa3VxOnbpEYGxdrrAKQilj0,1470
9
- h2lib_tests/test_static_solver.py,sha256=Ik_CgGiFVibEPq0dGzSfSYH3gv_dTm-qcz6JKmJiH_A,3228
10
- h2lib_tests/test_topology_h2lib.py,sha256=cClNtAIc1wR_gZa7eDO4ZySvhScqCEIHVMKZEhk29QE,4980
11
- h2lib_tests/test_write_htc.py,sha256=3KMHffkR8A6C1RXODxq_O522fEBfJwp3YpjDmUmiNjU,4774
11
+ h2lib_tests/test_static_solver.py,sha256=OiabTF7IwIskkvBslp32c5o4v53YHQNTTV3vOU5vVb8,4679
12
+ h2lib_tests/test_topology_h2lib.py,sha256=AIPgO6ePVoZbjX_ECmlQu8Iog1dIBzd192hkXBvg1V0,9651
12
13
  h2lib_tests/test_files/__init__.py,sha256=9e6ZUPb42e0wf2E1rutdcTM8hROcWFRVPXtZriU3ySw,50
13
14
  h2lib_tests/test_files/my_test_cls.py,sha256=7ZDsFkxrLfOY6q00U5Y-daxfuhATK-K5H04RP-VmQdE,850
14
15
  h2lib_tests/test_files/DTU_10_MW/control/dtu_we_controller.dll,sha256=C5T_CuAFtIuDgCXSYAoNu24yKPwj2nWOeORacJbLN9s,1134592
@@ -39,10 +40,11 @@ h2lib_tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Towertop_st.dat,sha256=iW8Rzj
39
40
  h2lib_tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_ae.dat,sha256=LkAlElRW_Fl1V4GD8hQZIgLD4IW0o3uxXL2olnEU3dI,1531
40
41
  h2lib_tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_pc.dat,sha256=2Nc_ofcqfCB3iu8dSFRj8Ub6AhaQADdW0O8BXBWj5Uk,26888
41
42
  h2lib_tests/test_files/DTU_10_MW/data/operation.dat,sha256=QH3ULApoKiZJfT4Z65aGNuqKln0fMCcbgN2GX6H1XSM,1262
42
- h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT.htc,sha256=80y88seN4BL_gAiM-RYaTlZxKCYJMr27IBdCX38O6DE,32313
43
+ h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT.htc,sha256=gBDcGmlmm9UWpYE1fvqc5tKcla82aSBLsgqG6YwOb-0,32314
43
44
  h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_mann_turb.htc,sha256=-jFK-ra64GeY3fQrP8FxeZ25DkQMdS8yQ9sO78SS9G8,32006
45
+ h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_no_aerodrag.htc,sha256=ELZNcQWlUdOsfSFq9iryvolbYgu5sd241lTfnyD8cS4,31705
44
46
  h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_no_output.htc,sha256=PxkaacH8iVp0ewk6x8fIjkITPUkiVar5bxZCWqZSoP4,25887
45
- h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_yaw_acturator.htc,sha256=FET165Hd3w6r0hwOeMU1WKARiBToIWL_tXPjYsjIatQ,33776
47
+ h2lib_tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_yaw_acturator.htc,sha256=WMxUTE_EJo39AjPfNm3zhjNkSyGli-qwcc0GRauTkw4,33790
46
48
  h2lib_tests/test_files/IEA-15-240-RWT/IEA_15MW_RWT_Blade_st_FPM.st,sha256=ytwFSx1cFSF25vZ8WZpYFiV2aL3DTvetPrR7oEqFYpc,16605
47
49
  h2lib_tests/test_files/IEA-15-240-RWT/IEA_15MW_RWT_Blade_st_noFPM.st,sha256=Pdb8rfJoV7zOAmbPn_xUyGgQk-xIjQ5fCZPRzsu9Q-M,20945
48
50
  h2lib_tests/test_files/IEA-15-240-RWT/IEA_15MW_RWT_Dummy_st.dat,sha256=fJGn9bFdMwCV1ceoxT2SUbuDMuNJGCaeqHWUqFlyfKE,532
@@ -87,7 +89,7 @@ h2lib_tests/test_files/minimal/res/minimal_mann_turb.hdf5,sha256=Q3cs3bZyplZjBpo
87
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
88
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
89
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
90
- h2lib_tests-13.1.506.dist-info/METADATA,sha256=wvzBrJm0RO6QivFp3_Hx4Pol3PqGCk_9WyxwgOtyuao,349
91
- h2lib_tests-13.1.506.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
92
- h2lib_tests-13.1.506.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
93
- h2lib_tests-13.1.506.dist-info/RECORD,,
92
+ h2lib_tests-13.1.1701.dist-info/METADATA,sha256=1tLVPkKby2An0pyGcag6URmy27CMnDpb2dpYfCx_0kk,349
93
+ h2lib_tests-13.1.1701.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
94
+ h2lib_tests-13.1.1701.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
95
+ h2lib_tests-13.1.1701.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,126 +0,0 @@
1
- import pytest
2
- from wetb.hawc2.htc_file import HTCFile
3
- from h2lib_tests.test_files import tfp
4
-
5
-
6
- @pytest.fixture(scope="module")
7
- def write_dtu10mw_only_tower():
8
- # Start from DTU_10MW_RWT and delete everything except the tower.
9
- htc = HTCFile(tfp + "DTU_10_MW/htc/DTU_10MW_RWT.htc")
10
- htc.set_name("DTU_10MW_RWT_only_tower")
11
- for key1 in htc["new_htc_structure"].keys():
12
- if key1.startswith("main_body"):
13
- if "tower" not in htc["new_htc_structure"][key1]["name"].values:
14
- htc["new_htc_structure"][key1].delete()
15
- if key1 == "orientation":
16
- for key2 in htc["new_htc_structure"]["orientation"].keys():
17
- if key2.startswith("relative"):
18
- htc["new_htc_structure"]["orientation"][key2].delete()
19
- if key1 == "constraint":
20
- for key2 in htc["new_htc_structure"]["constraint"].keys():
21
- if key2 != "fix0":
22
- htc["new_htc_structure"]["constraint"][key2].delete()
23
- htc["wind"].delete()
24
- htc["aerodrag"].delete()
25
- htc["aero"].delete()
26
- htc["dll"].delete()
27
- htc["output"].delete()
28
- # Reduce simulation time.
29
- htc.simulation.time_stop = 10.0
30
- # Change number of bodies in the tower.
31
- htc.new_htc_structure.main_body.nbodies = 3
32
- # Save the new file.
33
- htc.save()
34
- return htc
35
-
36
-
37
- @pytest.fixture(scope="module")
38
- def write_dtu10mw_only_tower_rotated(write_dtu10mw_only_tower):
39
- # Start from the DTU_10MW_RWT_only_tower and rotate the tower.
40
- htc = write_dtu10mw_only_tower.copy()
41
- htc.set_name("DTU_10MW_RWT_only_tower_rotated")
42
- alpha = 30.0
43
- htc.new_htc_structure.orientation.base.body_eulerang = [
44
- alpha,
45
- 0.0,
46
- 0.0,
47
- ]
48
- htc.save()
49
- return (htc, alpha)
50
-
51
-
52
- @pytest.fixture(scope="module")
53
- def write_dtu10mw_only_tower_encrypted(write_dtu10mw_only_tower):
54
- # Start from the DTU_10MW_RWT_only_tower and then encrypt the tower.
55
- htc = write_dtu10mw_only_tower.copy()
56
- htc.set_name("DTU_10MW_RWT_only_tower_encrypted")
57
- # Only the tower is left.
58
- htc.new_htc_structure.main_body.timoschenko_input.filename = "./data/DTU_10MW_RWT_Tower_st.dat.v3.enc"
59
- htc.save()
60
-
61
-
62
- @pytest.fixture(scope="module")
63
- def write_dtu10mw_only_blade():
64
- # Start from DTU_10MW_RWT and delete everything except the blade.
65
- htc = HTCFile(tfp + "DTU_10_MW/htc/DTU_10MW_RWT.htc")
66
- htc.set_name("DTU_10MW_RWT_only_blade")
67
- for key1 in htc["new_htc_structure"].keys():
68
- if key1.startswith("main_body"):
69
- if "blade1" not in htc["new_htc_structure"][key1]["name"].values:
70
- htc["new_htc_structure"][key1].delete()
71
- if key1 == "orientation":
72
- htc["new_htc_structure"][key1].delete()
73
- if key1 == "constraint":
74
- htc["new_htc_structure"][key1].delete()
75
- htc["wind"].delete()
76
- htc["aerodrag"].delete()
77
- htc["aero"].delete()
78
- htc["dll"].delete()
79
- htc["output"].delete()
80
-
81
- # Set the blade horizontal, to maximize gravity loading.
82
- htc.new_htc_structure.add_section("orientation")
83
- htc.new_htc_structure.orientation.add_section("base")
84
- htc.new_htc_structure.orientation.base.mbdy = "blade1"
85
- htc.new_htc_structure.orientation.base.inipos = [0.0, 0.0, 0.0]
86
- htc.new_htc_structure.orientation.base["mbdy_eulerang"] = [90.0, 0.0, 0.0]
87
- htc.new_htc_structure.orientation.base.mbdy_eulerang.comments = "Blade span is horizontal."
88
-
89
- # Clamp the blade.
90
- htc.new_htc_structure.add_section("constraint")
91
- htc.new_htc_structure.constraint.add_section("fix0")
92
- htc.new_htc_structure.constraint.fix0.mbdy = "blade1"
93
-
94
- # Set as many bodies as elements.
95
- htc.new_htc_structure.main_body__7.nbodies = 26
96
-
97
- # Reduce simulation time to 1 time step.
98
- htc.simulation.time_stop = 0.01
99
- htc.simulation.log_deltat.delete()
100
-
101
- # Do not use static solver, since it will be done during the test.
102
- htc.simulation.solvertype = 2
103
- htc.simulation.solvertype.comments = ""
104
- htc.simulation.initial_condition = 1
105
-
106
- # No output, as we will use add_sensor().
107
- # htc.add_section("output")
108
- # htc.output.data_format = "gtsdf"
109
- # htc.output.buffer = 10000
110
-
111
- # Save the new file.
112
- htc.save()
113
-
114
- return htc
115
-
116
-
117
- @pytest.fixture(scope="module")
118
- def write_dtu10mw_only_blade_low_max_iter(write_dtu10mw_only_blade):
119
- # Start from the write_dtu10mw_only_blade and thenreduce the number of max iterations,
120
- # so that the static solver will not have time to converge.
121
- htc = write_dtu10mw_only_blade.copy()
122
- htc.set_name("DTU_10MW_RWT_only_blade_low_max_iter")
123
- htc.simulation.max_iterations = 1
124
- htc.save()
125
-
126
- return htc