h2lib 13.0.408__cp38-cp38-win_amd64.whl → 13.0.410__cp38-cp38-win_amd64.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.
Files changed (52) hide show
  1. h2lib/HAWC2Lib.dll +0 -0
  2. h2lib/_h2lib.py +2 -2
  3. {h2lib-13.0.408.dist-info → h2lib-13.0.410.dist-info}/METADATA +2 -5
  4. h2lib-13.0.410.dist-info/RECORD +10 -0
  5. h2lib/tests/__init__.py +0 -0
  6. h2lib/tests/dtu10mw.py +0 -102
  7. h2lib/tests/test_calc.py +0 -67
  8. h2lib/tests/test_ellipsys_couplings.py +0 -50
  9. h2lib/tests/test_files/DTU_10_MW/DTU_10MW_RWT_hs2.htc +0 -351
  10. h2lib/tests/test_files/DTU_10_MW/HAWC2License_64.dll +0 -0
  11. h2lib/tests/test_files/DTU_10_MW/control/dtu_we_controller.dll +0 -0
  12. h2lib/tests/test_files/DTU_10_MW/control/dtu_we_controller.so +0 -0
  13. h2lib/tests/test_files/DTU_10_MW/control/dtu_we_controller_64.dll +0 -0
  14. h2lib/tests/test_files/DTU_10_MW/control/generator_servo.dll +0 -0
  15. h2lib/tests/test_files/DTU_10_MW/control/generator_servo.so +0 -0
  16. h2lib/tests/test_files/DTU_10_MW/control/generator_servo_64.dll +0 -0
  17. h2lib/tests/test_files/DTU_10_MW/control/mech_brake.dll +0 -0
  18. h2lib/tests/test_files/DTU_10_MW/control/mech_brake.so +0 -0
  19. h2lib/tests/test_files/DTU_10_MW/control/mech_brake_64.dll +0 -0
  20. h2lib/tests/test_files/DTU_10_MW/control/servo_with_limits.dll +0 -0
  21. h2lib/tests/test_files/DTU_10_MW/control/servo_with_limits.so +0 -0
  22. h2lib/tests/test_files/DTU_10_MW/control/servo_with_limits_64.dll +0 -0
  23. h2lib/tests/test_files/DTU_10_MW/control/towerclearance_mblade.dll +0 -0
  24. h2lib/tests/test_files/DTU_10_MW/control/towerclearance_mblade.so +0 -0
  25. h2lib/tests/test_files/DTU_10_MW/control/towerclearance_mblade_64.dll +0 -0
  26. h2lib/tests/test_files/DTU_10_MW/control/wpdata.100 +0 -9
  27. h2lib/tests/test_files/DTU_10_MW/controller_input_quadratic_example.txt +0 -77
  28. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Blade_st.dat +0 -109
  29. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Hub_st.dat +0 -9
  30. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Shaft_st.dat +0 -10
  31. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Tower_st.dat +0 -44
  32. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_Towertop_st.dat +0 -9
  33. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_ae.dat +0 -42
  34. h2lib/tests/test_files/DTU_10_MW/data/DTU_10MW_RWT_pc.dat +0 -638
  35. h2lib/tests/test_files/DTU_10_MW/data/operation.dat +0 -22
  36. h2lib/tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT.htc +0 -693
  37. h2lib/tests/test_files/DTU_10_MW/htc/DTU_10MW_RWT_mann_turb.htc +0 -681
  38. h2lib/tests/test_files/DTU_10_MW/log/dtu_10mw_rwt_ver09.log +0 -210
  39. h2lib/tests/test_files/__init__.py +0 -2
  40. h2lib/tests/test_files/minimal/__init__.py +0 -0
  41. h2lib/tests/test_files/minimal/htc/__init__.py +0 -0
  42. h2lib/tests/test_files/minimal/htc/minimal.htc +0 -32
  43. h2lib/tests/test_files/minimal/htc/minimal_mann_turb.htc +0 -41
  44. h2lib/tests/test_files/minimal/res/minimal_mann_turb.hdf5 +0 -0
  45. h2lib/tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_u +0 -0
  46. h2lib/tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_v +0 -0
  47. h2lib/tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_w +0 -0
  48. h2lib/tests/test_h2lib.py +0 -217
  49. h2lib/tests/test_h2rotor.py +0 -162
  50. h2lib-13.0.408.dist-info/RECORD +0 -55
  51. {h2lib-13.0.408.dist-info → h2lib-13.0.410.dist-info}/WHEEL +0 -0
  52. {h2lib-13.0.408.dist-info → h2lib-13.0.410.dist-info}/top_level.txt +0 -0
@@ -1,210 +0,0 @@
1
- Logfile: ./log/dtu_10mw_rwt_ver09.log is open for log outputs
2
- ***********************************************************************
3
- * Build information for HAWC2MB
4
- * Aeroelastic tool HAWC2MB
5
- * Intel, version 2021 , 20201112
6
- * WINDOWS 64-bit
7
- * DEBUG version
8
- ***********************************************************************
9
- * GIT-TAG = 13.0.3-1-g750149b-dirty
10
- * GIT-BRANCH = master
11
- * BUILD_TYPE =
12
- * BUILDER = mmpe
13
- * COMPUTER_NAME = DTU-5CG8462XTX
14
- * BUILD_DATE = 03-08-2023
15
- ***********************************************************************
16
- ________________________________________________________________________
17
- Log file output
18
- Time : 13:20:28
19
- Date : 21:08.2023
20
- ________________________________________________________________________
21
- Newmark commands read with succes
22
- Simulation commands read with succes
23
- Reading data of main body : tower
24
- Succes opening ./data/DTU_10MW_RWT_Tower_st.dat
25
- timoschenko input commands read with succes
26
- topologi_c2def_inputs read with succes
27
- Topologi main body tower commands read with succes
28
- Reading data of main body : towertop
29
- Succes opening ./data/DTU_10MW_RWT_Towertop_st.dat
30
- timoschenko input commands read with succes
31
- topologi_c2def_inputs read with succes
32
- Topologi main body towertop commands read with succes
33
- Reading data of main body : shaft
34
- Succes opening ./data/DTU_10MW_RWT_Shaft_st.dat
35
- timoschenko input commands read with succes
36
- topologi_c2def_inputs read with succes
37
- Topologi main body shaft commands read with succes
38
- Reading data of main body : hub1
39
- Succes opening ./data/DTU_10MW_RWT_Hub_st.dat
40
- timoschenko input commands read with succes
41
- topologi_c2def_inputs read with succes
42
- Topologi main body hub1 commands read with succes
43
- Reading data of main body : hub2
44
- Topologi main body hub2 commands read with succes
45
- Reading data of main body : hub3
46
- Topologi main body hub3 commands read with succes
47
- Reading data of main body : blade1
48
- Succes opening ./data/DTU_10MW_RWT_Blade_st.dat
49
- timoschenko input commands read with succes
50
- topologi_c2def_inputs read with succes
51
- Topologi main body blade1 commands read with succes
52
- Reading data of main body : blade2
53
- Topologi main body blade2 commands read with succes
54
- Reading data of main body : blade3
55
- Topologi main body blade3 commands read with succes
56
- Base orientation input commands read with succes
57
- relative orientation input commands read with succes
58
- relative orientation input commands read with succes
59
- relative orientation input commands read with succes
60
- relative orientation input commands read with succes
61
- relative orientation input commands read with succes
62
- relative orientation input commands read with succes
63
- relative orientation input commands read with succes
64
- relative orientation input commands read with succes
65
- Orientation input commands read with succes
66
- Fix0 constraint input commands read with succes
67
- Fix1 constraint input commands read with succes
68
- Bearing1 constraint input commands read with succes
69
- Fix1 constraint input commands read with succes
70
- Fix1 constraint input commands read with succes
71
- Fix1 constraint input commands read with succes
72
- bearing2 constraint input commands read with succes
73
- bearing2 constraint input commands read with succes
74
- bearing2 constraint input commands read with succes
75
- constraint input commands read with succes
76
- Topologi commands read with succes
77
- Tower shadow (potential2 flow) commands read with succes
78
- Wind commands read with succes
79
- aerodrag element commands read with succes
80
- aerodrag element commands read with succes
81
- Aerodrag commands read with succes
82
- Aerodynamic commands read with succes
83
- output commands read with succes
84
- Output commands read
85
- Dll type2 input commands read with succes
86
- output commands read with succes
87
- Output commands read
88
- Actions commands read
89
- Dll type2 input commands read with succes
90
- output commands read with succes
91
- Output commands read
92
- Actions commands read
93
- Dll type2 input commands read with succes
94
- output commands read with succes
95
- Output commands read
96
- Actions commands read
97
- Dll type2 input commands read with succes
98
- output commands read with succes
99
- Output commands read
100
- Dll type2 input commands read with succes
101
- DLL commands read with succes
102
- output commands read with succes
103
- Output commands read
104
- Initialization of structure
105
- Initializing of aero rotor...
106
- Initialization of rotor aerodynamics
107
- Succes opening ./data/DTU_10MW_RWT_ae.dat
108
- Succes opening ./data/DTU_10MW_RWT_pc.dat
109
- Initialization of rotor induction
110
- Initialization of wind
111
- Initialization of external type2 DLL
112
- External DLL ./control/dtu_we_controller.dll is attempted to open
113
- DLL loaded with success ./control/dtu_we_controller_64.dll
114
- Using ./control/dtu_we_controller_64.dll, version: 0.5-2-g885d71c
115
- DLL subroutine init init_regulation_advanced is called
116
- In initialization call of ./control/dtu_we_controller.dll Output is
117
- 0.000000000000000E+000
118
- *** WARNING *** Symbol not found in dll: message
119
- *** INFO *** The DLL subroutine message could not be loaded - bypassed!
120
- Initialization of external type2 DLL
121
- External DLL ./control/generator_servo.dll is attempted to open
122
- DLL loaded with success ./control/generator_servo_64.dll
123
- Using ./control/generator_servo_64.dll, version: 0.2
124
- DLL subroutine init init_generator_servo is called
125
- In initialization call of ./control/generator_servo.dll Output is
126
- 0.000000000000000E+000
127
- *** WARNING *** Symbol not found in dll: message
128
- *** INFO *** The DLL subroutine message could not be loaded - bypassed!
129
- Initialization of external type2 DLL
130
- External DLL ./control/mech_brake.dll is attempted to open
131
- DLL loaded with success ./control/mech_brake_64.dll
132
- Using ./control/mech_brake_64.dll, version: 0.2
133
- DLL subroutine init init_mech_brake is called
134
- In initialization call of ./control/mech_brake.dll Output is
135
- 0.000000000000000E+000
136
- *** WARNING *** Symbol not found in dll: message
137
- *** INFO *** The DLL subroutine message could not be loaded - bypassed!
138
- Initialization of external type2 DLL
139
- External DLL ./control/servo_with_limits.dll is attempted to open
140
- DLL loaded with success ./control/servo_with_limits_64.dll
141
- Using ./control/servo_with_limits_64.dll, version: 1.2
142
- DLL subroutine init init_servo_with_limits is called
143
- In initialization call of ./control/servo_with_limits.dll Output is
144
- 0.000000000000000E+000
145
- *** WARNING *** Symbol not found in dll: message
146
- *** INFO *** The DLL subroutine message could not be loaded - bypassed!
147
- Initialization of external type2 DLL
148
- External DLL ./control/towerclearance_mblade.dll is attempted to open
149
- DLL loaded with success ./control/towerclearance_mblade_64.dll
150
- Using ./control/towerclearance_mblade_64.dll, version: 1.0.1-1-g8e11be3
151
- DLL subroutine init initialize is called
152
- In initialization call of ./control/towerclearance_mblade.dll Output is
153
- 0.000000000000000E+000
154
- *** WARNING *** Symbol not found in dll: message
155
- *** INFO *** The DLL subroutine message could not be loaded - bypassed!
156
- Creating link between structure and aerodynamics
157
- Creating link between structure and aerodrag
158
- Initialization of Aerodrag
159
- Starting simulation
160
- Constraint residual is .6752E-13 < .10E-06. Max residual in constraint 50
161
- Dynamic stall method: 2 used for entire rotor
162
- ... initialization of unified dynamic stall model.
163
- DS model deactivated: blade 1 at 0mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
164
- DS model deactivated: blade 1 at 88mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
165
- DS model deactivated: blade 1 at 355mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
166
- DS model deactivated: blade 1 at 797mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
167
- DS model deactivated: blade 1 at 1414mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
168
- DS model deactivated: blade 1 at 2203mm. Max f_sep= 4.24, dclda= 0.00, thickness= 99.77. See manual to change limit values
169
- DS model deactivated: blade 1 at 3160mm. Max f_sep= 4.24, dclda= 0.01, thickness= 98.69. See manual to change limit values
170
- DS model deactivated: blade 1 at 4282mm. Max f_sep= 4.24, dclda= 0.01, thickness= 97.41. See manual to change limit values
171
- DS model deactivated: blade 1 at 5565mm. Max f_sep= 4.24, dclda= 0.02, thickness= 94.83. See manual to change limit values
172
- DS model deactivated: blade 1 at 7002mm. Max f_sep= 4.24, dclda= 0.04, thickness= 90.40. See manual to change limit values
173
- DS model deactivated: blade 1 at 8588mm. Max f_sep= 4.24, dclda= 0.07, thickness= 84.54. See manual to change limit values
174
- DS model deactivated: blade 1 at 10317mm. Max f_sep= 4.24, dclda= 0.10, thickness= 77.35. See manual to change limit values
175
- DS model deactivated: blade 1 at 12181mm. Max f_sep= 4.24, dclda= 0.14, thickness= 69.22. See manual to change limit values
176
- DS model deactivated: blade 1 at 14172mm. Max f_sep= 4.24, dclda= 0.18, thickness= 60.80. See manual to change limit values
177
- DS model deactivated: blade 1 at 16283mm. Max f_sep= 1.12, dclda= 2.62, thickness= 53.05. See manual to change limit values
178
- DS model deactivated: blade 2 at 0mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
179
- DS model deactivated: blade 2 at 88mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
180
- DS model deactivated: blade 2 at 355mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
181
- DS model deactivated: blade 2 at 797mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
182
- DS model deactivated: blade 2 at 1414mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
183
- DS model deactivated: blade 2 at 2203mm. Max f_sep= 4.24, dclda= 0.00, thickness= 99.77. See manual to change limit values
184
- DS model deactivated: blade 2 at 3160mm. Max f_sep= 4.24, dclda= 0.01, thickness= 98.69. See manual to change limit values
185
- DS model deactivated: blade 2 at 4282mm. Max f_sep= 4.24, dclda= 0.01, thickness= 97.41. See manual to change limit values
186
- DS model deactivated: blade 2 at 5565mm. Max f_sep= 4.24, dclda= 0.02, thickness= 94.83. See manual to change limit values
187
- DS model deactivated: blade 2 at 7002mm. Max f_sep= 4.24, dclda= 0.04, thickness= 90.40. See manual to change limit values
188
- DS model deactivated: blade 2 at 8588mm. Max f_sep= 4.24, dclda= 0.07, thickness= 84.54. See manual to change limit values
189
- DS model deactivated: blade 2 at 10317mm. Max f_sep= 4.24, dclda= 0.10, thickness= 77.35. See manual to change limit values
190
- DS model deactivated: blade 2 at 12181mm. Max f_sep= 4.24, dclda= 0.14, thickness= 69.22. See manual to change limit values
191
- DS model deactivated: blade 2 at 14172mm. Max f_sep= 4.24, dclda= 0.18, thickness= 60.80. See manual to change limit values
192
- DS model deactivated: blade 2 at 16283mm. Max f_sep= 1.12, dclda= 2.62, thickness= 53.05. See manual to change limit values
193
- DS model deactivated: blade 3 at 0mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
194
- DS model deactivated: blade 3 at 88mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
195
- DS model deactivated: blade 3 at 355mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
196
- DS model deactivated: blade 3 at 797mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
197
- DS model deactivated: blade 3 at 1414mm. Max f_sep= 0.00, dclda= 0.00, thickness=100.00. See manual to change limit values
198
- DS model deactivated: blade 3 at 2203mm. Max f_sep= 4.24, dclda= 0.00, thickness= 99.77. See manual to change limit values
199
- DS model deactivated: blade 3 at 3160mm. Max f_sep= 4.24, dclda= 0.01, thickness= 98.69. See manual to change limit values
200
- DS model deactivated: blade 3 at 4282mm. Max f_sep= 4.24, dclda= 0.01, thickness= 97.41. See manual to change limit values
201
- DS model deactivated: blade 3 at 5565mm. Max f_sep= 4.24, dclda= 0.02, thickness= 94.83. See manual to change limit values
202
- DS model deactivated: blade 3 at 7002mm. Max f_sep= 4.24, dclda= 0.04, thickness= 90.40. See manual to change limit values
203
- DS model deactivated: blade 3 at 8588mm. Max f_sep= 4.24, dclda= 0.07, thickness= 84.54. See manual to change limit values
204
- DS model deactivated: blade 3 at 10317mm. Max f_sep= 4.24, dclda= 0.10, thickness= 77.35. See manual to change limit values
205
- DS model deactivated: blade 3 at 12181mm. Max f_sep= 4.24, dclda= 0.14, thickness= 69.22. See manual to change limit values
206
- DS model deactivated: blade 3 at 14172mm. Max f_sep= 4.24, dclda= 0.18, thickness= 60.80. See manual to change limit values
207
- DS model deactivated: blade 3 at 16283mm. Max f_sep= 1.12, dclda= 2.62, thickness= 53.05. See manual to change limit values
208
- Global time = 1.000000000000000E-002 Iter = 1
209
- Creating file folder res
210
- Creating file folder res
@@ -1,2 +0,0 @@
1
- import os
2
- tfp = os.path.dirname (__file__) + "/"
File without changes
File without changes
@@ -1,32 +0,0 @@
1
- begin simulation;
2
- time_stop 1000.0;
3
- solvertype 1 ; (newmark)
4
- on_no_convergence continue ;
5
- convergence_limits 1E3 1.0 1E-7 ;
6
- log_deltat 1;
7
- begin newmark;
8
- deltat 0.1;
9
- end newmark;
10
- end simulation;
11
- ;
12
- ;----------------------------------------------------------------------------------------------------------------------------------------------------------------
13
- begin wind ;
14
- density 1.225 ;
15
- wsp 5.0 ;
16
- tint 0.1 ;
17
- horizontal_input 0 ;
18
- windfield_rotations 0.0 0 0.0 ; yaw, tilt, rotation
19
- center_pos0 0 2 0 ; hub heigth
20
- shear_format 0 0.2 ;
21
- turb_format 0 ; 0=none, 1=mann,2=flex
22
- tower_shadow_method 0 ; 0=none, 1=potential flow, 2=jet
23
- scale_time_start 0.0 ;
24
- end wind;
25
- ;
26
- begin output;
27
- filename res/minimal;
28
- data_format gtsdf64;
29
- buffer 1;
30
- general time;
31
- end output;
32
- exit;
@@ -1,41 +0,0 @@
1
- begin simulation;
2
- time_stop 140.0;
3
- solvertype 1 ; (newmark)
4
- on_no_convergence continue ;
5
- convergence_limits 1E3 1.0 1E-7 ;
6
- begin newmark;
7
- deltat 0.1;
8
- end newmark;
9
- end simulation;
10
- ;
11
- ;----------------------------------------------------------------------------------------------------------------------------------------------------------------
12
- begin wind ;
13
- density 1.225 ;
14
- wsp 5.0 ;
15
- tint 0.1 ;
16
- horizontal_input 0 ;
17
- windfield_rotations 0.0 0.0 0.0 ; yaw, tilt, rotation
18
- center_pos0 46.5 2 -30 ; hub heigth
19
- shear_format 0 0.2 ;
20
- turb_format 1 ; 0=none, 1=mann,2=flex
21
- tower_shadow_method 0 ; 0=none, 1=potential flow, 2=jet
22
- scale_time_start 0.0 ;
23
- begin mann;
24
- create_turb_parameters 33.6 .1 3.9 1 0;
25
- filename_u turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_u;
26
- filename_v turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_v;
27
- filename_w turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_w;
28
- box_dim_u 512 2;
29
- box_dim_v 32 3;
30
- box_dim_w 16 4;
31
- reverse_mann_box 0;
32
- dont_scale 1;
33
- end mann;
34
- end wind;
35
- ;
36
- begin output;
37
- filename res/minimal_mann_turb;
38
- data_format gtsdf64;
39
- wind free_wind 1 0 0 0;
40
- end output;
41
- exit;
h2lib/tests/test_h2lib.py DELETED
@@ -1,217 +0,0 @@
1
- from wetb.gtsdf import gtsdf
2
- import matplotlib.pyplot as plt
3
- import numpy as np
4
- from numpy import newaxis as na
5
- import pytest
6
- from h2lib._h2lib import H2Lib, MultiH2Lib
7
- from numpy import testing as npt
8
- from h2lib.tests.test_files import tfp
9
- from wetb.hawc2.htc_file import HTCFile
10
- import time
11
- from tqdm import tqdm
12
-
13
-
14
- def test_echo_version():
15
- with H2Lib() as h2:
16
- h2.suppress_output = False
17
- h2.echo_version()
18
- h2.suppress_output = True
19
-
20
-
21
- def test_sensors():
22
- with H2Lib() as h2:
23
- model_path = tfp + "minimal/"
24
- htc = HTCFile(model_path + 'htc/minimal.htc')
25
- htc.output.add_sensor("general", 'variable', [1, 5, 'mysensor', 'myunit', 'mydesc'])
26
- htc.set_name('tmp')
27
- htc.save()
28
- h2.read_input('htc/tmp.htc', model_path)
29
- i1 = h2.add_sensor('wind free_wind 1 0 0 -119;') # adds three sensors
30
- assert i1 == 3
31
- i2 = h2.add_sensor('general step 0.5 1 2;')
32
- assert i2 == 4
33
- i3 = h2.add_sensor('general variable 1 5 myname myunit mydesc;')
34
- assert i3 == 5
35
- h2.init()
36
- t = h2.step()
37
- assert h2.get_sensor_info(1) == ['WSP gl. coo.,Vx', 'm/s',
38
- 'Free wind speed Vx, gl. coo, of gl. pos 0.00, 0.00,-119.00']
39
- assert h2.get_sensor_info(2) == ['WSP gl. coo.,Vy', 'm/s',
40
- 'Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00,-119.00']
41
- assert h2.get_sensor_info(3) == ['WSP gl. coo.,Vz', 'm/s',
42
- 'Free wind speed Vz, gl. coo, of gl. pos 0.00, 0.00,-119.00']
43
- assert h2.get_sensor_info(4) == ['Step', '-', 'Step value']
44
- assert h2.get_sensor_info(5) == ['myname', 'myunit', 'mydesc']
45
-
46
- r = []
47
- for _ in range(10):
48
- r.append([t, h2.get_sensor_value(4), h2.get_sensor_value(5)])
49
- if t == 0.6:
50
- h2.set_variable_sensor_value(1, 2)
51
- t = h2.step()
52
- r = np.array(r)
53
- npt.assert_array_equal(r[:, 1], np.where(r[:, 0] <= .5, 1, 2))
54
- npt.assert_array_equal(r[:, 2], np.where(r[:, 0] >= .7, 2, 5.))
55
- time, data, _ = gtsdf.load(h2.model_path + 'res/tmp.hdf5')
56
- npt.assert_array_equal(data[:, 0], np.where(time >= .7, 2, 5.))
57
-
58
-
59
- def test_set_windspeed_uvw():
60
- with H2Lib() as h2:
61
- pos = [0, 0, -119]
62
- model_path = tfp + "minimal/"
63
- h2.read_input('htc/minimal.htc', model_path)
64
- Nxyz = [8, 4, 2]
65
- h2.init_windfield(Nxyz, dxyz=[1., 1, 1], box_offset_yz=[0., -119])
66
- h2.init()
67
- u, v, w = 1, 2, 3
68
- uvw = np.zeros([3] + Nxyz) + np.array([u, v, w])[:, na, na, na]
69
- h2.set_windfield(uvw, 0)
70
- vx, vy, vz = h2.get_wind_speed(pos)
71
- assert vx == v
72
- assert vy == u
73
- assert vz == -w
74
- npt.assert_array_equal([u, v, w], h2.get_uvw(pos))
75
-
76
-
77
- def test_set_windspeed_interpolation():
78
- with H2Lib() as h2:
79
- model_path = tfp + "minimal/"
80
- h2.read_input('htc/minimal.htc', model_path)
81
- Nxyz = np.array([8, 4, 2])
82
- h2.init_windfield(Nxyz, dxyz=[2., 3, 4], box_offset_yz=[-4.5, 117])
83
- h2.init()
84
- uvw = np.array(np.meshgrid(np.arange(Nxyz[0]) + 100, np.arange(Nxyz[1]) + 200, np.arange(Nxyz[2]) + 300,
85
- indexing='ij'),
86
- dtype=np.float64)
87
- h2.set_windfield(uvw, 0)
88
-
89
- # test u
90
- y = np.linspace(0, 14, 10)
91
- np.testing.assert_array_almost_equal([h2.get_wind_speed([0, y_, 0])[1] for y_ in y], np.linspace(100, 107, 10))
92
-
93
- h2.set_windfield(uvw, -5.)
94
- # box moved -6m offset
95
- np.testing.assert_array_almost_equal([h2.get_wind_speed([0, y_, 0])[1]
96
- for y_ in y - 5], np.linspace(100, 107, 10))
97
-
98
- h2.run(3)
99
- # box moved 3s * 5m/s - 5m offset = 10
100
- np.testing.assert_array_almost_equal([h2.get_wind_speed([0, y_, 0])[1]
101
- for y_ in y + 10], np.linspace(100, 107, 10))
102
-
103
- h2.set_windfield(uvw, -5.)
104
- # box moved 6m offset
105
- np.testing.assert_array_almost_equal([h2.get_wind_speed([0, y_, 0])[1]
106
- for y_ in y - 5], np.linspace(100, 107, 10))
107
-
108
- # test v
109
- x = np.linspace(-4.5, 4.5, 10)
110
- np.testing.assert_array_almost_equal([h2.get_wind_speed([x_, 0, 0])[0] for x_ in x], np.linspace(200, 203, 10))
111
-
112
- # test w
113
- z = np.linspace(-117, -121, 10)
114
- np.testing.assert_array_almost_equal([h2.get_wind_speed([0, 0, z_])[2] for z_ in z], -np.linspace(300, 301, 10))
115
-
116
-
117
- def test_mann_turb():
118
- with H2Lib() as h2:
119
- U = 5
120
- from hipersim import MannTurbulenceField
121
- mtf = MannTurbulenceField.from_hawc2(filenames=[tfp + f'minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_{uvw}' for uvw in 'uvw'],
122
- alphaepsilon=.1, L=33.6, Gamma=3.9,
123
- Nxyz=(512, 32, 16), dxyz=(2, 3, 4), seed=1, HighFreqComp=0)
124
-
125
- time, data, _ = gtsdf.load(tfp + 'minimal/res/minimal_mann_turb.hdf5')
126
- time, data = time[1000:], data[1000:]
127
- vx, vy, vz = data.T
128
- h2_uvw = [vy, vx, -vz]
129
- model_path = tfp + "minimal/"
130
- h2.read_input('htc/minimal.htc', model_path)
131
- h2.init_windfield(Nxyz=mtf.Nxyz, dxyz=mtf.dxyz, box_offset_yz=[0, 0])
132
- h2.init()
133
- h2.set_windfield(uvw=mtf.uvw.astype(np.float64), box_offset_x=-(mtf.Nx - 1) * mtf.dx)
134
- h2l_vxyz = []
135
- for t in tqdm(time, disable=0):
136
- h2.run(t)
137
- h2l_vxyz.append(h2.get_wind_speed([0, 0, 0]))
138
- vx, vy, vz = np.array(h2l_vxyz).T
139
- h2l_uvw = [vy, vx, -vz]
140
-
141
- x = (mtf.Nx * mtf.dx) - U * time - 2
142
- mtf_uvw = mtf(x, x * 0, x * 0).T
143
-
144
- if 0:
145
- plt.plot(time, h2_uvw[0], label='h2')
146
- plt.plot(time, mtf_uvw[0], label='mtf')
147
- plt.plot(time, h2l_uvw[0], label='h2l')
148
- plt.legend()
149
- plt.show()
150
-
151
- npt.assert_array_almost_equal(mtf_uvw, h2_uvw)
152
- npt.assert_array_almost_equal(mtf_uvw, h2l_uvw)
153
-
154
-
155
- def test_mann_turb_small_buffer():
156
- with H2Lib() as h2:
157
- from hipersim import MannTurbulenceField
158
- U = 5
159
- mtf = MannTurbulenceField.from_hawc2(filenames=[tfp + f'minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_{uvw}' for uvw in 'uvw'],
160
- alphaepsilon=.1, L=33.6, Gamma=3.9,
161
- Nxyz=(512, 32, 16), dxyz=(2, 3, 4), seed=1, HighFreqComp=0)
162
-
163
- time, data, _ = gtsdf.load(tfp + 'minimal/res/minimal_mann_turb.hdf5')
164
- time, data = time[:1400], data[:1400]
165
- vx, vy, vz = data.T
166
- h2_uvw = [vy, vx, -vz]
167
- model_path = tfp + "minimal/"
168
- h2.read_input('htc/minimal.htc', model_path)
169
- h2.init_windfield(Nxyz=(128, 32, 16), dxyz=mtf.dxyz, box_offset_yz=[0, 0])
170
- h2.init()
171
- h2l_vxyz = []
172
- h2.set_windfield(uvw=mtf.uvw[:, -128:].astype(np.float64), box_offset_x=-(mtf.Nx - 1) * mtf.dx)
173
- for t in tqdm(time):
174
- t = np.round(t, 6)
175
- h2.run(t)
176
- if t % 40 == 0:
177
- i = int(512 - 128 - t * U / 2)
178
- h2.set_windfield(uvw=mtf.uvw[:, i:i + 128].astype(np.float64), box_offset_x=-(mtf.Nx - 1) * mtf.dx)
179
- h2l_vxyz.append(h2.get_wind_speed([0, 0, 0]))
180
- vx, vy, vz = np.array(h2l_vxyz).T
181
- h2l_uvw = [vy, vx, -vz]
182
-
183
- x = ((mtf.Nx - 1) * mtf.dx) - U * time
184
- mtf_uvw = mtf(x, x * 0, x * 0).T
185
-
186
- if 0:
187
- plt.plot(time, h2_uvw[0], '-', label='h2')
188
- plt.plot(time, mtf_uvw[0], '--', label='mtf')
189
- plt.plot(time, h2l_uvw[0], '-', label='h2l')
190
- plt.legend()
191
- plt.show()
192
-
193
- npt.assert_array_almost_equal(mtf_uvw, h2_uvw)
194
- npt.assert_array_almost_equal(mtf_uvw, h2l_uvw)
195
-
196
-
197
- def test_parallel():
198
- N = 3
199
- mh2 = MultiH2Lib(N)
200
- assert mh2.getState() == [0, 0, 0]
201
- mh2.setState([4, 5, 6])
202
- assert mh2.getState() == [4, 5, 6]
203
- mh2.close()
204
-
205
-
206
- def test_parallel_context_manager():
207
- N = 3
208
- with MultiH2Lib(N) as mh2:
209
- mh2.init_windfield(Nxyz=(128, 32, 16), dxyz=[(1, 2, 3), (4, 5, 6), (7, 8, 9)], box_offset_yz=[0, 0])
210
- assert mh2.getState() == [0, 0, 0]
211
- mh2.setState([4, 5, 6])
212
- assert mh2.getState() == [4, 5, 6]
213
- mh2[0].setState(10)
214
- assert mh2.getState() == [10, 5, 6]
215
- t = time.time()
216
- mh2.work(2)
217
- assert time.time() - t < 2.5
@@ -1,162 +0,0 @@
1
- import pytest
2
-
3
- from h2lib._h2lib import H2Lib, MultiH2Lib
4
- from h2lib.tests.test_files import tfp
5
- import numpy as np
6
- import matplotlib.pyplot as plt
7
- from h2lib.tests.dtu10mw import DTU10MW
8
- from wetb.gtsdf import gtsdf
9
- from numpy import testing as npt
10
- from h2lib.utils import ProcessClass
11
-
12
-
13
- def get_h2(htc_path='htc/DTU_10MW_RWT.htc'):
14
- h2 = ProcessClass(H2Lib)()
15
- h2.read_input(htc_path=htc_path, model_path=tfp + 'DTU_10_MW')
16
-
17
- return h2
18
-
19
-
20
- @pytest.fixture(scope='module')
21
- def h2():
22
- h2 = get_h2()
23
- h2.init()
24
- h2.step()
25
- yield h2
26
- h2.close()
27
-
28
-
29
- def test_get_nxxx(h2):
30
- assert h2.get_rotor_dims() == [[50, 50, 50]]
31
-
32
-
33
- def test_get_bem_grid_dim(h2):
34
- assert h2.get_bem_grid_dim() == [16, 50]
35
-
36
-
37
- def test_get_bem_grid(h2):
38
- azi, rad = h2.get_bem_grid()
39
-
40
- npt.assert_array_almost_equal(np.roll(np.linspace(-np.pi, np.pi, 17)[1:], 9), azi)
41
- npt.assert_array_almost_equal([3.09929662, 11.4350243, 33.76886193, 60.8641887, 82.01217305], rad[::10])
42
-
43
-
44
- def test_induction(h2):
45
- azi, rad = h2.get_bem_grid()
46
- induc_grid = h2.get_induction_polargrid()
47
- induc_axisymmetric = h2.get_induction_axisymmetric()
48
- if 0:
49
- Azi, Rad = np.meshgrid(azi, rad)
50
- ax = plt.gcf().add_subplot(111, polar=True)
51
- ax.set_theta_zero_location('S')
52
- ax.set_theta_direction(-1)
53
- cntf = ax.contourf(Azi, Rad, induc_grid.T, 50)
54
- plt.colorbar(cntf)
55
- plt.figure()
56
- plt.plot(rad, induc_axisymmetric)
57
- plt.show()
58
-
59
- npt.assert_array_almost_equal(np.mean(induc_grid, 0), induc_axisymmetric)
60
-
61
-
62
- def test_rotor_orientation_multi_instance():
63
- dtu10 = DTU10MW()
64
-
65
- dtu10.set_name('tmp_5_0')
66
- dtu10.save()
67
-
68
- tilt_ref, yaw_ref = 6, 10
69
- dtu10.set_tilt_cone_yaw(tilt=tilt_ref, cone=0, yaw=yaw_ref)
70
- dtu10.set_name('tmp_6_10')
71
- dtu10.save()
72
- with MultiH2Lib(2) as mh2:
73
- mh2.read_input(['htc/tmp_5_0.htc', 'htc/tmp_6_10.htc'], model_path=tfp + "DTU_10_MW")
74
- #h2.suppress_output = False
75
- s_id = mh2.add_sensor('aero power')[0]
76
- mh2.init()
77
- yaw, tilt, _ = zip(*mh2.get_rotor_orientation(deg=True))
78
- np.testing.assert_almost_equal(yaw, [0, 10])
79
- np.testing.assert_almost_equal(tilt, [5, 6])
80
- h2 = mh2[0]
81
- res = []
82
- for t in np.arange(0, 2.5, .01):
83
- h2.run(t)
84
- res.append([h2.get_rotor_orientation(deg=True)[2], h2.get_sensor_value(s_id)] +
85
- h2.get_rotor_position().tolist())
86
-
87
- data = gtsdf.load(h2.model_path + '/res/tmp_5_0.hdf5')[1]
88
- res = np.array(res)
89
- npt.assert_allclose(data[:, 0], res[1:-1, 0] % 360 - 180, rtol=0.002) # azi
90
- npt.assert_array_almost_equal(data[:, 10], res[1:-1, 1]) # power
91
- npt.assert_array_almost_equal(data[:, 15:18], res[1:-1, 2:5]) # rotor position
92
-
93
-
94
- def test_rotor_avg_windspeed():
95
- h2 = get_h2()
96
- h2.init_windfield(Nxyz=(2, 2, 2), dxyz=(200, 200, 200), box_offset_yz=(-100, -19))
97
- h2.init()
98
- u = np.zeros((2, 2, 2))
99
- u[:, 1, :] = 10 # 0 in one side, 10 in other, 5 in avg
100
- h2.set_windfield([u, u * 0, u * 0], -100)
101
- h2.step()
102
-
103
- npt.assert_almost_equal(h2.get_rotor_avg_wsp(1), 5)
104
-
105
-
106
- def test_aerosections():
107
- plot = False
108
- h2 = get_h2()
109
- h2.suppress_output = False
110
- # blade 1, global coo, r>30
111
- pos_ids = [h2.add_sensor(f'aero position 3 1 {xyz} 30') for xyz in [1, 2, 3]]
112
- wsp_ids = [h2.add_sensor(f'aero windspeed 3 1 {xyz} 30') for xyz in [1, 2, 3]]
113
- frc_ids = [h2.add_sensor(f'aero secforce 1 {xyz} 30 3') for xyz in [1, 2, 3]]
114
- mom_ids = [h2.add_sensor(f'aero secmoment 1 {xyz} 30 3') for xyz in [1, 2, 3]]
115
- h2.init()
116
-
117
- a = h2.get_aerosections_position()
118
- if plot:
119
- ax = plt.figure().add_subplot(projection='3d')
120
- for b in a:
121
- ax.plot(*b.T)
122
- plt.show()
123
-
124
- assert a.shape == (3, 50, 3)
125
-
126
- r = np.sqrt(np.sum((a[0, :] - a[0, 0])**2, 1))
127
- i = np.searchsorted(r, 30)
128
-
129
- h2.step()
130
- name, unit, desc = h2.get_sensor_info(pos_ids)
131
- assert str(np.round(r[i], 2)) in desc
132
- assert str(np.round(r[i], 1)) in name
133
- assert unit == 'm'
134
-
135
- a = h2.get_aerosections_position()
136
- npt.assert_array_almost_equal(a[0, i], [h2.get_sensor_value(id) for id in pos_ids])
137
- uvw = a * 0
138
- uvw[:, :, 0] = 6
139
- uvw[0, i, 0] = 12
140
- h2.run(3)
141
- npt.assert_array_equal([h2.get_sensor_value(id) for id in wsp_ids], [0, 6, 0])
142
- npt.assert_array_almost_equal([h2.get_sensor_value(id) for id in frc_ids],
143
- h2.get_aerosections_load()[0][0, i] / 1000)
144
-
145
- frc_before = h2.get_aerosections_load()[0]
146
- if plot:
147
- plt.figure()
148
- plt.plot(frc_before[:, :, 1].T)
149
-
150
- h2.set_aerosections_windspeed(uvw)
151
- h2.step()
152
- frc_after = h2.get_aerosections_load()[0]
153
- if plot:
154
- plt.plot(frc_after[:, :, 1].T, '--')
155
- plt.show()
156
-
157
- # Fy in section with u=12 instead of u=6m/s more than doubled
158
- assert frc_before[0, i, 1] * 2 < frc_after[0, i, 1]
159
-
160
- # rest is similar (within 7N/m, max Fxyz along blade is [331 , 378, 288]
161
- frc_after[0, i, :] = frc_before[0, i, :]
162
- npt.assert_allclose(frc_before, frc_after, atol=7)