h2lib-tests 13.1.3__py3-none-any.whl → 13.1.201__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.
@@ -1,4 +1,4 @@
1
- from h2lib._h2lib import MultiH2Lib
1
+ from h2lib._h2lib import MultiH2Lib, H2LibThread
2
2
  import numpy as np
3
3
  from wetb.hawc2.htc_file import HTCFile
4
4
  from numpy import newaxis as na
@@ -23,6 +23,31 @@ class Ellipsys():
23
23
  pass
24
24
 
25
25
 
26
+ def test_ellipsys_dummy_workflow_1wt():
27
+
28
+ N = 1
29
+ with MultiH2Lib(N, suppress_output=True) as h2:
30
+ el = Ellipsys()
31
+ htc = HTCFile(tfp + 'DTU_10_MW/htc/DTU_10MW_RWT.htc')
32
+ for i in range(N):
33
+ htc.set_name(f'wt{i}')
34
+ htc.save()
35
+
36
+ h2.init(htc_path=f'htc/wt0.htc', model_path=tfp + 'DTU_10_MW')
37
+ wt_pos = np.array([0, 0, 0])
38
+
39
+ while True:
40
+ t = el.step()
41
+ pos_gl_xyz = np.array(h2.get_aerosections_position(), order='F') + wt_pos[na, na, :]
42
+ uvw = np.asfortranarray(el.get_uvw(pos_gl_xyz))
43
+ h2.set_aerosections_windspeed(uvw)
44
+ h2.run(t) # run after set_aero_windspeed requires initilalize of bem before disabling
45
+ frc_gl_xyz = h2.get_aerosections_forces()
46
+ el.set_fxyz(pos_gl_xyz, frc_gl_xyz)
47
+ if t == 1:
48
+ break
49
+
50
+
26
51
  def test_ellipsys_dummy_workflow():
27
52
 
28
53
  N = 4
@@ -33,12 +58,10 @@ def test_ellipsys_dummy_workflow():
33
58
  htc.set_name(f'wt{i}')
34
59
  htc.save()
35
60
 
36
- h2.read_input(htc_path=[f'htc/wt{i}.htc' for i in range(N)],
37
- model_path=tfp + 'DTU_10_MW')
61
+ h2.init(htc_path=[f'htc/wt{i}.htc' for i in range(N)],
62
+ model_path=tfp + 'DTU_10_MW')
38
63
  wt_pos = np.array([[0, 0, 0], [0, 500, 0], [0, 1000, 0], [0, 1500, 0]])
39
64
 
40
- h2.init()
41
-
42
65
  while True:
43
66
  t = el.step()
44
67
  h2.run(t)
h2lib_tests/test_h2lib.py CHANGED
@@ -34,7 +34,7 @@ def test_sensors():
34
34
  with H2Lib() as h2:
35
35
  model_path = tfp + "minimal/"
36
36
  htc = HTCFile(model_path + 'htc/minimal.htc')
37
- htc.output.add_sensor("general", 'variable', [1, 5, 'mysensor', 'myunit', 'mydesc'])
37
+ htc.output.add_sensor("general", 'variable', [1, 5, 'mysensor1', 'myunit1', 'mydesc1'])
38
38
  htc.output.add_sensor("wind", 'free_wind', [1, 5, 0, -119])
39
39
  htc.wind.shear_format = 1, 0
40
40
 
@@ -47,7 +47,7 @@ def test_sensors():
47
47
  assert i1 == (1, 2, 3)
48
48
  i2 = h2.add_sensor('general step 0.5 1 2;')
49
49
  assert i2 == (4,)
50
- i3 = h2.add_sensor('general variable 1 5 myname myunit mydesc;')
50
+ i3 = h2.add_sensor('general variable 1 5 # $name(myname2) $unit(myunit2) $desc(mydesc2);')
51
51
  assert i3 == (5,)
52
52
  t = h2.step()
53
53
  assert h2.get_sensor_info(1) == ['WSP gl. coo.,Vx', 'm/s',
@@ -58,7 +58,7 @@ def test_sensors():
58
58
  'Free wind speed Vz, gl. coo, of gl. pos 0.00, 0.00,-119.00']
59
59
  assert [n for n, u, d in h2.get_sensor_info(i1)] == ['WSP gl. coo.,Vx', 'WSP gl. coo.,Vy', 'WSP gl. coo.,Vz']
60
60
  assert h2.get_sensor_info(4) == ['Step', '-', 'Step value']
61
- assert h2.get_sensor_info(5) == ['myname', 'myunit', 'mydesc']
61
+ assert h2.get_sensor_info(5) == ['myname2', 'myunit2', 'mydesc2'], h2.get_sensor_info(5)
62
62
 
63
63
  r = []
64
64
  for _ in range(10):
h2lib_tests/test_mpi.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import h2lib
2
- from h2lib._h2lib import H2LibProcess, MultiH2Lib
2
+ from h2lib._h2lib import H2LibProcess, MultiH2Lib, set_LD_LIBRARY_PATH
3
3
  import os
4
4
  import time
5
5
 
@@ -14,6 +14,8 @@ import numpy as np
14
14
  from h2lib_tests.test_files.my_test_cls import MyTest
15
15
  from multiclass_interface import mpi_interface
16
16
 
17
+ set_LD_LIBRARY_PATH
18
+
17
19
 
18
20
  def mpitest_mpi_MyTest():
19
21
 
@@ -69,8 +71,7 @@ def mpitest_MultiH2Lib():
69
71
  lib_path = "LibNotInLD_LIBRARY_PATH"
70
72
  if lib_path in os.environ.get('LD_LIBRARY_PATH', '') or os.path.relpath(
71
73
  lib_path, os.getcwd()) in os.environ.get('LD_LIBRARY_PATH', ''):
72
- # assert mh2.cls == H2LibThread, mh2.cls
73
- assert mh2.cls == H2LibProcess, mh2.cls
74
+ assert mh2.cls == H2LibThread, mh2.cls
74
75
  else:
75
76
  assert mh2.cls == H2LibProcess, mh2.cls
76
77
  else:
@@ -140,9 +141,9 @@ def ellipsys_mpi_dummy_workflow():
140
141
 
141
142
 
142
143
  def mpitest_all():
144
+ mpi_interface.activate_mpi()
143
145
  mpi_interface.exit_mpi_on_close = False
144
- from mpi4py import MPI
145
- rank = MPI.COMM_WORLD.Get_rank()
146
+ rank = mpi_interface.rank
146
147
  from h2lib_tests.test_ellipsys_couplings import test_ellipsys_dummy_workflow
147
148
  from h2lib_tests.test_h2lib import test_parallel_context_manager, test_parallel
148
149
  from h2lib_tests.test_h2rotor import test_rotor_orientation_multi_instance
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: h2lib-tests
3
- Version: 13.1.3
4
- Summary: Tests and test_files for test h2lib (13.0.15+2-g7269dc1)
3
+ Version: 13.1.201
4
+ Summary: Tests and test_files for test h2lib (13.1.2+5-g396f274)
5
5
  Download-URL:
6
6
  Author: Mads M Pedersen
7
7
  Author-email:
@@ -1,10 +1,10 @@
1
1
  h2lib_tests/__init__.py,sha256=VjSqfGg8BzdmSjfSFhJh4hZbYZ_cME7xp9EWFKHQphA,61
2
2
  h2lib_tests/dtu10mw.py,sha256=a7SXfyDwDQPastYKb5CgghOQcYfgO1eTwGrd-H3Enok,4374
3
3
  h2lib_tests/test_calc.py,sha256=VNLfr2J9R2Jy9xTbdZ9dfbQ4dCwr7H7nbZRI3yP69fQ,2152
4
- h2lib_tests/test_ellipsys_couplings.py,sha256=KcZy6M_1gpsEPVes86r5w3B1x80z72Io5UoYN4C0vgg,1512
5
- h2lib_tests/test_h2lib.py,sha256=EHdOLD8S_0OeTT1GTPQW5m66NKyhB3lKS9YW56mwUQY,12492
4
+ h2lib_tests/test_ellipsys_couplings.py,sha256=69I_2h_PMfuIUgxnlLp_6bkS5IEpWMWnnPV1sRrWEp0,2399
5
+ h2lib_tests/test_h2lib.py,sha256=YhA0x-bg9kKYiXyaqsOsSENNtbNovUU399df5cxpZRM,12547
6
6
  h2lib_tests/test_h2rotor.py,sha256=kaE9AFDYSPaMFSgBAbeegd7-l6Z_4_BsQaWie0k32q4,6210
7
- h2lib_tests/test_mpi.py,sha256=CP_-0evPoHa4rVSPH9c2Vit5oLiTuVHlM30mXS1DBTI,6851
7
+ h2lib_tests/test_mpi.py,sha256=emBgXRAvvFFOsVrAziiQCUZvEF9HS5Wc-x4KqqltQP0,6835
8
8
  h2lib_tests/test_multiprocessinterface.py,sha256=h2o4havtK6IuMXsplNjGUa3VxOnbpEYGxdrrAKQilj0,1470
9
9
  h2lib_tests/utils.py,sha256=Kj1WxegDt0SR-l9jNKnTIDx9QczoYi-7LUnWSSDcTKM,2859
10
10
  h2lib_tests/test_files/__init__.py,sha256=9e6ZUPb42e0wf2E1rutdcTM8hROcWFRVPXtZriU3ySw,50
@@ -80,7 +80,7 @@ h2lib_tests/test_files/minimal/res/minimal_mann_turb.hdf5,sha256=Q3cs3bZyplZjBpo
80
80
  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
81
81
  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
82
82
  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
83
- h2lib_tests-13.1.3.dist-info/METADATA,sha256=KGpetzGskresIUOLOz06mXIAWbPAJh6LfoJlx8Etxqk,359
84
- h2lib_tests-13.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
85
- h2lib_tests-13.1.3.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
86
- h2lib_tests-13.1.3.dist-info/RECORD,,
83
+ h2lib_tests-13.1.201.dist-info/METADATA,sha256=YoiITYyIa1fSOPKirNmra3PYMS1T0m6gSXmZagtzNGY,360
84
+ h2lib_tests-13.1.201.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
85
+ h2lib_tests-13.1.201.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
86
+ h2lib_tests-13.1.201.dist-info/RECORD,,