h2lib 13.2.702__py3-none-win_amd64.whl → 13.2.801__py3-none-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.
h2lib/HAWC2Lib.dll CHANGED
Binary file
h2lib/_h2lib.py CHANGED
@@ -22,6 +22,7 @@ _ERROR_CODES = {
22
22
  300: ValueError("TOO_FEW_SECTIONS_IN_C2DEF"),
23
23
  301: ValueError("BEAM_TOO_SHORT"),
24
24
  302: ValueError("DIFFERENT_NSEC"),
25
+ 400: ValueError("ST_Z_NOT_CONTINUOUSLY_INCREASING"),
25
26
  500: ValueError("RELATIVE_ROTATION_NOT_FOUND"),
26
27
  700: RuntimeError("SYSTEM_NOT_LINEARIZED"),
27
28
  701: RuntimeError("SYSTEM_EIGENANALYSIS_NOT_DONE"),
@@ -65,25 +66,25 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
65
66
 
66
67
  def close(self):
67
68
  if self._initialized:
68
- self.write_output()
69
- self.finalize()
69
+ self._write_output()
70
+ self._finalize()
70
71
  DLLWrapper.close(self)
71
72
  return "closed h2lib"
72
73
 
73
74
  def getState(self):
74
- return H2LibSignatures.getState(self, restype=np.int32)[1]
75
+ return H2LibSignatures._getState(self, restype=np.int32)[1]
75
76
 
76
77
  def work(self, time):
77
78
  """Return number of loops"""
78
- return H2LibSignatures.work(self, np.float64(time), restype=np.int64)[1]
79
+ return H2LibSignatures._work(self, np.float64(time), restype=np.int64)[1]
79
80
 
80
81
  def loop(self, N):
81
82
  """Return time to compute N loops"""
82
- return H2LibSignatures.loop(self, int(N), restype=np.float64)[1]
83
+ return H2LibSignatures._loop(self, int(N), restype=np.float64)[1]
83
84
 
84
85
  def get_version(self):
85
86
  s = " " * 255
86
- return H2LibSignatures.get_version(self, s)[0][0].strip()
87
+ return H2LibSignatures._get_version(self, s)[0][0].strip()
87
88
 
88
89
  def stop_on_error(self, flag):
89
90
  """
@@ -100,7 +101,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
100
101
  None.
101
102
 
102
103
  """
103
- H2LibSignatures.stop_on_error(self, bool(flag))
104
+ H2LibSignatures._stop_on_error(self, bool(flag))
104
105
 
105
106
  def get_wind_speed(self, pos_g):
106
107
  return self.get_lib_function('get_wind_speed')(np.asfortranarray(pos_g, dtype=np.float64),
@@ -111,18 +112,18 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
111
112
  return [vy, vx, -vz]
112
113
 
113
114
  def get_time(self):
114
- return np.round(H2LibSignatures.get_time(self, time=0.)[0][0], 6)
115
+ return np.round(H2LibSignatures._get_time(self, time=0.)[0][0], 6)
115
116
 
116
117
  def read_input(self, htc_path, model_path='.'):
117
118
  if htc_path is not None:
118
119
  self._model_path = model_path
119
120
  self.cwd = self.model_path
120
- return H2LibSignatures.read_input(self, htc_path)
121
+ return H2LibSignatures._read_input(self, htc_path)
121
122
 
122
123
  def init(self, htc_path=None, model_path='.'):
123
124
  assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
124
125
  self.read_input(htc_path, model_path)
125
- r = H2LibSignatures.init(self)
126
+ r = H2LibSignatures._init(self)
126
127
  self._initialized = True
127
128
  return r
128
129
 
@@ -139,8 +140,8 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
139
140
  """
140
141
  assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
141
142
  self.read_input(htc_path, model_path)
142
- r = H2LibSignatures.init_AD(self, rotor + 1, int(tiploss_method),
143
- float(tiploss2_shen_c2), float(tiploss2_shen_h))
143
+ r = H2LibSignatures._init_AD(self, rotor + 1, int(tiploss_method),
144
+ float(tiploss2_shen_c2), float(tiploss2_shen_h))
144
145
  self._initialized = True
145
146
  return r
146
147
 
@@ -158,12 +159,12 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
158
159
  """
159
160
  assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
160
161
  self.read_input(htc_path, model_path)
161
- r = H2LibSignatures.init_AL(self, rotor=rotor + 1, epsilon_smearing=float(epsilon_smearing))
162
+ r = H2LibSignatures._init_AL(self, rotor=rotor + 1, epsilon_smearing=float(epsilon_smearing))
162
163
  self._initialized = True
163
164
  return r
164
165
 
165
166
  def step(self):
166
- self.time = np.round(H2LibSignatures.step(self, restype=np.float64)[1], 6)
167
+ self.time = np.round(H2LibSignatures._step(self, restype=np.float64)[1], 6)
167
168
  return self.time
168
169
 
169
170
  def predict(self): # pragma: no cover
@@ -175,7 +176,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
175
176
  self.get_lib_function('step_correct_hawc2')()
176
177
 
177
178
  def run(self, time):
178
- self.time = np.round(H2LibSignatures.run(self, np.float64(time), restype=np.float64)[1], 6)
179
+ self.time = np.round(H2LibSignatures._run(self, np.float64(time), restype=np.float64)[1], 6)
179
180
  return self.time
180
181
 
181
182
  def check_convergence(self):
@@ -197,7 +198,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
197
198
  resq = -1.0
198
199
  resg = -1.0
199
200
  resd = -1.0
200
- bconv, resq, resg, resd = H2LibSignatures.check_convergence(self, bconv, resq, resg, resd)[0]
201
+ bconv, resq, resg, resd = H2LibSignatures._check_convergence(self, bconv, resq, resg, resd)[0]
201
202
  return bconv, resq, resg, resd
202
203
 
203
204
  def linearize(self):
@@ -214,7 +215,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
214
215
  """
215
216
  n_tdofs = -1
216
217
  n_rdofs = -1
217
- res = H2LibSignatures.linearize(self, n_tdofs, n_rdofs)[0]
218
+ res = H2LibSignatures._linearize(self, n_tdofs, n_rdofs)[0]
218
219
  return res
219
220
 
220
221
  def do_system_eigenanalysis(self, n_modes, include_damping=True):
@@ -249,7 +250,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
249
250
  error_code = -1
250
251
 
251
252
  _, _, natural_frequencies, damping_ratios, error_code = (
252
- H2LibSignatures.do_system_eigenanalysis(
253
+ H2LibSignatures._do_system_eigenanalysis(
253
254
  self,
254
255
  include_damping,
255
256
  n_modes,
@@ -304,11 +305,11 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
304
305
  if include_damping:
305
306
  ny = 2 * n_rdofs
306
307
  dtype = np.complex128
307
- f = H2LibSignatures.get_system_eigval_eigvec_with_damping
308
+ f = H2LibSignatures._get_system_eigval_eigvec_with_damping
308
309
  else:
309
310
  ny = n_rdofs
310
311
  dtype = np.float64
311
- f = H2LibSignatures.get_system_eigval_eigvec_without_damping
312
+ f = H2LibSignatures._get_system_eigval_eigvec_without_damping
312
313
 
313
314
  error_code = -1
314
315
  eigenvalues = np.zeros((n_modes,), dtype=dtype, order="F")
@@ -337,7 +338,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
337
338
  None.
338
339
 
339
340
  """
340
- H2LibSignatures.solver_static_init(self)
341
+ H2LibSignatures._solver_static_init(self)
341
342
 
342
343
  def solver_static_update(self):
343
344
  """
@@ -354,7 +355,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
354
355
 
355
356
  """
356
357
  error_code = -1
357
- error_code = H2LibSignatures.solver_static_update(self, error_code)[0][0]
358
+ error_code = H2LibSignatures._solver_static_update(self, error_code)[0][0]
358
359
  if error_code > 0:
359
360
  raise _ERROR_CODES[error_code]
360
361
 
@@ -373,7 +374,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
373
374
 
374
375
  """
375
376
  error_code = -1
376
- error_code = H2LibSignatures.solver_static_solve(self, error_code)[0][0]
377
+ error_code = H2LibSignatures._solver_static_solve(self, error_code)[0][0]
377
378
  if error_code > 0:
378
379
  raise _ERROR_CODES[error_code]
379
380
 
@@ -386,7 +387,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
386
387
  None.
387
388
 
388
389
  """
389
- H2LibSignatures.solver_static_delete(self)
390
+ H2LibSignatures._solver_static_delete(self)
390
391
 
391
392
  def solver_static_run(self, reset_structure=False):
392
393
  """
@@ -416,13 +417,13 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
416
417
 
417
418
  """
418
419
  error_code = -1
419
- _, error_code = H2LibSignatures.solver_static_run(self, reset_structure, error_code, check_stop=False)[0]
420
+ _, error_code = H2LibSignatures._solver_static_run(self, reset_structure, error_code, check_stop=False)[0]
420
421
  if error_code > 0:
421
422
  raise _ERROR_CODES[error_code]
422
423
 
423
424
  def structure_reset(self):
424
425
  """Reset the structure deflection and orientation."""
425
- H2LibSignatures.structure_reset(self)
426
+ H2LibSignatures._structure_reset(self)
426
427
 
427
428
  def add_sensor(self, sensor_line):
428
429
  """Add sensor to hawc2. The sensor will be accessible from h2lib but will not show up in the output file of HAWC2
@@ -441,7 +442,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
441
442
  if ";" not in sensor_line:
442
443
  sensor_line += ";"
443
444
  index_start, index_stop = 0, 0
444
- index_start, index_stop = H2LibSignatures.add_sensor(self, sensor_line.lower(), index_start, index_stop)[0][1:]
445
+ index_start, index_stop = H2LibSignatures._add_sensor(self, sensor_line.lower(), index_start, index_stop)[0][1:]
445
446
  return tuple(range(index_start, index_stop + 1))
446
447
 
447
448
  def get_sensor_info(self, id):
@@ -449,7 +450,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
449
450
  if isinstance(id, tuple):
450
451
  return [self.get_sensor_info(i) for i in id]
451
452
  return [s[:-1].strip() # remove null termination
452
- for s in H2LibSignatures.get_sensor_info(self, id, name=" " * 30, unit=" " * 10, desc=" " * 512)[0][1:]]
453
+ for s in H2LibSignatures._get_sensor_info(self, id, name=" " * 30, unit=" " * 10, desc=" " * 512)[0][1:]]
453
454
 
454
455
  def get_sensor_values(self, id_lst):
455
456
  """Get sensor values from HAWC2
@@ -467,10 +468,10 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
467
468
  return self.get_sensor_values([id_lst])[0]
468
469
  values = np.zeros(len(id_lst), dtype=np.float64)
469
470
  id_lst = np.array(id_lst, dtype=np.int64)
470
- return H2LibSignatures.get_sensor_values(self, id_lst, values, len(id_lst))[0][1]
471
+ return H2LibSignatures._get_sensor_values(self, id_lst, values, len(id_lst))[0][1]
471
472
 
472
473
  def set_variable_sensor_value(self, id, value):
473
- return H2LibSignatures.set_variable_sensor_value(self, id, np.float64(value))
474
+ return H2LibSignatures._set_variable_sensor_value(self, id, np.float64(value))
474
475
 
475
476
  def set_orientation_base(
476
477
  self,
@@ -528,7 +529,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
528
529
  # 1D arrays are converted to 2D with 1 row.
529
530
  mbdy_eulerang_table = np.atleast_2d(mbdy_eulerang_table)
530
531
  error_code = -1
531
- error_code = H2LibSignatures.set_orientation_base(
532
+ error_code = H2LibSignatures._set_orientation_base(
532
533
  self,
533
534
  main_body,
534
535
  mbdy_eulerang_table.shape[0],
@@ -618,7 +619,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
618
619
  if node_2 == "last":
619
620
  node_2 = -2
620
621
  error_code = -1
621
- error_code = H2LibSignatures.set_orientation_relative(
622
+ error_code = H2LibSignatures._set_orientation_relative(
622
623
  self,
623
624
  main_body_1,
624
625
  node_1 + 1,
@@ -669,8 +670,8 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
669
670
  repeated in the longitudinal direction
670
671
 
671
672
  """
672
- return H2LibSignatures.init_windfield(self, np.array(Nxyz, dtype=np.int64), np.array(dxyz, dtype=np.float64),
673
- np.array(box_offset_yz, dtype=np.float64), np.float64(transport_speed))
673
+ return H2LibSignatures._init_windfield(self, np.array(Nxyz, dtype=np.int64), np.array(dxyz, dtype=np.float64),
674
+ np.array(box_offset_yz, dtype=np.float64), np.float64(transport_speed))
674
675
 
675
676
  def set_windfield(self, uvw, box_offset_x, time=None):
676
677
  """Set wind field, must be called after init_windfield and init
@@ -699,32 +700,38 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
699
700
  time = self.get_time()
700
701
  uvw = np.asfortranarray(uvw, dtype=np.float32)
701
702
  assert np.all(np.isfinite(uvw)), "uvw passed to h2lib.set_windfield contains nan or inf"
702
- return H2LibSignatures.set_windfield(self, uvw, np.float64(box_offset_x), np.float64(time))
703
+ return H2LibSignatures._set_windfield(self, uvw, np.float64(box_offset_x), np.float64(time))
703
704
 
704
705
  def set_c2_def(
705
- self, main_body_name, c2_def, twist_in_deg=True, check_length=True
706
+ self, main_body_name, c2_def, twist_in_deg=True, check_length=True, update_structure=True
706
707
  ):
707
708
  """
708
- Set c2_def, which defines the centerline of the specified main body.
709
+ Set `c2_def` or `cx_def` for the specified main body.
709
710
 
710
711
  Parameters
711
712
  ----------
712
713
  main_body_name : str
713
714
  Name of main body that must be updated.
714
- c2_def : (:, 4) ndarray
715
- New c2_def. It is an array with at least 2 rows and 4 columns for x, y, z and twist.
715
+ c2_def : (:, 4) or (:, 5) ndarray
716
+ New c2_def/cx_def. It is an array with at least 2 rows and 4 columns for x, y, z and twist.
717
+ Optionally, the 5th column can be used for dx (default is 0.)
716
718
  The number of rows, i.e. sections, must match the ones in the original c2_def.
717
719
  twist_in_deg : bool, optional
718
720
  `True` if the twist (last column in c2_def) is given in [deg].
719
721
  `False` if it is given in [rad]. The default is `True`.
720
722
  check_length : bool, optional
721
723
  `True` if the new beam length needs to be checked, `False` otherwise. The default is `False`.
724
+ update_structure : bool, optional
725
+ If `True` (default) triggers the recomputation of the element matrices, constraints and so on.
726
+ It is required for the changes to c2_def to take effect. If the user updates both c2_def/cx_def
727
+ and st, only 1 structure update is required.
722
728
 
723
729
  Raises
724
730
  ------
725
731
  ValueError
726
732
  Can be due to:
727
733
  - MAIN_BODY_NOT_FOUND: none of the main bodies is called `main_body_name`.
734
+ - WRONG_NUMBER_OF_COLUMNS: cx_def must have 4 or 5 columns.
728
735
  - TOO_FEW_SECTIONS_IN_C2DEF: `c2_def` must have at least 2 sections, i.e. rows.
729
736
  - BEAM_TOO_SHORT: the minimum beam length is 1.0e-7.
730
737
  - DIFFERENT_NSEC: this command does not allow to add or remove sections,
@@ -738,13 +745,63 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
738
745
 
739
746
  """
740
747
  error_code = -1
741
- error_code = H2LibSignatures.set_c2_def(
748
+ error_code = H2LibSignatures._set_cx_def(
742
749
  self,
743
750
  main_body_name,
744
- np.asfortranarray(c2_def.astype(np.float64)),
745
751
  c2_def.shape[0],
752
+ c2_def.shape[1],
753
+ np.asfortranarray(c2_def, dtype=np.float64),
746
754
  bool(twist_in_deg),
747
755
  bool(check_length),
756
+ bool(update_structure),
757
+ error_code,
758
+ check_stop=False,
759
+ )[0][-1]
760
+
761
+ if error_code > 0:
762
+ raise _ERROR_CODES[error_code]
763
+
764
+ def set_st(
765
+ self, main_body_name, st, update_structure=True
766
+ ):
767
+ """
768
+ Set STructural data for the specified main body.
769
+
770
+ Parameters
771
+ ----------
772
+ main_body_name : str
773
+ Name of main body that must be updated.
774
+ st : (:, :) ndarray
775
+ New ST. It is an array with an arbitrary number of rows and 19 or 30 columns.
776
+ Both the classical Timoshenko and the FPM model are supported.
777
+ update_structure : bool, optional
778
+ If `True` (default) triggers the recomputation of the element matrices, constraints and so on.
779
+ It is required for the changes to st to take effect. If the user updates both c2_def/cx_def
780
+ and st, only 1 structure update is required.
781
+
782
+ Raises
783
+ ------
784
+ ValueError
785
+ Can be due to:
786
+ - MAIN_BODY_NOT_FOUND: none of the main bodies is called `main_body_name`.
787
+ - WRONG_NUMBER_OF_COLUMNS: `st` must have 19 or 30 columns.
788
+ - ST_Z_NOT_CONTINUOUSLY_INCREASING: The z coordinate must always increase.
789
+ NotImplementedError
790
+ Only the c2_def node distribution is supported.
791
+
792
+ Returns
793
+ -------
794
+ None.
795
+
796
+ """
797
+ error_code = -1
798
+ error_code = H2LibSignatures._set_st(
799
+ self,
800
+ main_body_name,
801
+ st.shape[0],
802
+ st.shape[1],
803
+ np.asfortranarray(st, dtype=np.float64),
804
+ bool(update_structure),
748
805
  error_code,
749
806
  check_stop=False,
750
807
  )[0][-1]
@@ -761,16 +818,16 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
761
818
  for r in range(self.get_nrotors())]
762
819
 
763
820
  def get_nrotors(self):
764
- return H2LibSignatures.get_nrotors(self, restype=np.int64)[1]
821
+ return H2LibSignatures._get_nrotors(self, restype=np.int64)[1]
765
822
 
766
823
  def get_nblades(self, rotor=0):
767
- return H2LibSignatures.get_nblades(self, rotor + 1, restype=np.int64)[1]
824
+ return H2LibSignatures._get_nblades(self, rotor + 1, restype=np.int64)[1]
768
825
 
769
826
  def get_nSections(self, rotor=0, blade=0):
770
- return H2LibSignatures.get_nSections(self, rotor + 1, blade + 1, restype=np.int64)[1]
827
+ return H2LibSignatures._get_nSections(self, rotor + 1, blade + 1, restype=np.int64)[1]
771
828
 
772
829
  def get_diameter(self, rotor=0):
773
- return H2LibSignatures.get_diameter(self, rotor + 1, restype=np.float64)[1]
830
+ return H2LibSignatures._get_diameter(self, rotor + 1, restype=np.float64)[1]
774
831
 
775
832
  def aero_sections_data_shape(self, rotor):
776
833
  if rotor not in self._aero_sections_data_shape:
@@ -780,63 +837,63 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
780
837
  def get_aerosections_position(self, rotor=0):
781
838
  """Global xyz position of aero sections. Shape=(#blades, #sections, 3)"""
782
839
  position = np.zeros(self.aero_sections_data_shape(rotor), dtype=np.float64, order='F')
783
- return H2LibSignatures.get_aerosections_position(self, rotor + 1, position)[0][1]
840
+ return H2LibSignatures._get_aerosections_position(self, rotor + 1, position)[0][1]
784
841
 
785
842
  def set_aerosections_windspeed(self, uvw, rotor=0):
786
843
  """Update wind speed at aero sections. uvw shape=(#blades, #sections, 3)"""
787
- return H2LibSignatures.set_aerosections_windspeed(self, rotor + 1, np.asfortranarray(uvw, np.float64))
844
+ return H2LibSignatures._set_aerosections_windspeed(self, rotor + 1, np.asfortranarray(uvw, np.float64))
788
845
 
789
846
  def get_aerosections_forces(self, rotor=0):
790
847
  shape = self.aero_sections_data_shape(rotor)
791
848
  Fxyz = np.zeros(shape, dtype=np.float64, order='F')
792
- return H2LibSignatures.get_aerosections_forces(self, rotor + 1, Fxyz)[0][1]
849
+ return H2LibSignatures._get_aerosections_forces(self, rotor + 1, Fxyz)[0][1]
793
850
 
794
851
  def get_aerosections_moments(self, rotor=0):
795
852
  shape = self.aero_sections_data_shape(rotor)
796
853
  Mxyz = np.zeros(shape, dtype=np.float64, order='F')
797
- return H2LibSignatures.get_aerosections_moments(self, rotor + 1, Mxyz)[0][1]
854
+ return H2LibSignatures._get_aerosections_moments(self, rotor + 1, Mxyz)[0][1]
798
855
 
799
856
  def get_bem_grid_dim(self, rotor=0):
800
857
  """returns (nazi, nrad)"""
801
- return H2LibSignatures.get_bem_grid_dim(self, rotor + 1, 0, 0)[0][1:]
858
+ return H2LibSignatures._get_bem_grid_dim(self, rotor + 1, 0, 0)[0][1:]
802
859
 
803
860
  def get_bem_grid(self, rotor=0):
804
861
  """returns azi, rad"""
805
862
  nazi, nrad = self.get_bem_grid_dim(rotor)
806
- return H2LibSignatures.get_bem_grid(self, rotor + 1,
807
- np.zeros(nazi, dtype=np.float64, order='F'),
808
- np.zeros(nrad, dtype=np.float64, order='F'))[0][1:]
863
+ return H2LibSignatures._get_bem_grid(self, rotor + 1,
864
+ np.zeros(nazi, dtype=np.float64, order='F'),
865
+ np.zeros(nrad, dtype=np.float64, order='F'))[0][1:]
809
866
 
810
867
  def get_induction_polargrid(self, rotor=0):
811
868
  nazi, nrad = self.get_bem_grid_dim(rotor)
812
869
  induction = np.zeros((nazi, nrad), dtype=np.float64, order='F')
813
- return H2LibSignatures.get_induction_polargrid(self, rotor + 1, induction)[0][1]
870
+ return H2LibSignatures._get_induction_polargrid(self, rotor + 1, induction)[0][1]
814
871
 
815
872
  def get_induction_axisymmetric(self, rotor=0):
816
873
  nrad = self.get_bem_grid_dim(rotor)[1]
817
874
  induction = np.zeros(nrad, dtype=np.float64)
818
- return H2LibSignatures.get_induction_axisymmetric(self, rotor + 1, induction)[0][1]
875
+ return H2LibSignatures._get_induction_axisymmetric(self, rotor + 1, induction)[0][1]
819
876
 
820
877
  def get_induction_rotoravg(self, rotor=0):
821
878
  induction = np.float64(0)
822
- return H2LibSignatures.get_induction_rotoravg(self, rotor + 1, induction)[0][1]
879
+ return H2LibSignatures._get_induction_rotoravg(self, rotor + 1, induction)[0][1]
823
880
 
824
881
  def get_rotor_orientation(self, rotor=0, deg=False):
825
882
  """return yaw, tilt, azi(of first blade) in rad(default) or deg"""
826
- r = H2LibSignatures.get_rotor_orientation(self, rotor=rotor + 1, yaw=0., tilt=0., azi=0.)[0][1:]
883
+ r = H2LibSignatures._get_rotor_orientation(self, rotor=rotor + 1, yaw=0., tilt=0., azi=0.)[0][1:]
827
884
  if deg:
828
885
  return np.rad2deg(r)
829
886
  else:
830
887
  return r
831
888
 
832
889
  def get_rotor_position(self, rotor=0):
833
- return H2LibSignatures.get_rotor_position(self, rotor=rotor + 1, position=np.zeros(3, dtype=np.float64))[0][1]
890
+ return H2LibSignatures._get_rotor_position(self, rotor=rotor + 1, position=np.zeros(3, dtype=np.float64))[0][1]
834
891
 
835
892
  def get_rotor_avg_wsp(self, coo=1, rotor=0):
836
893
  """Returns the rotor averaged wind speed in global(coo=1, default) or rotor(coo=2) coordinates."""
837
894
  assert self.time > 0
838
895
  wsp = np.zeros(3, dtype=np.float64)
839
- return H2LibSignatures.get_rotor_avg_wsp(self, coo=coo, rotor=rotor + 1, wsp=wsp)[0][2]
896
+ return H2LibSignatures._get_rotor_avg_wsp(self, coo=coo, rotor=rotor + 1, wsp=wsp)[0][2]
840
897
 
841
898
  def get_rotor_avg_uvw(self, rotor=0):
842
899
  vx, vy, vz = self.get_rotor_avg_wsp(1, rotor)
@@ -866,7 +923,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
866
923
  nbdy,
867
924
  ncst,
868
925
  error_code,
869
- ) = H2LibSignatures.get_number_of_bodies_and_constraints(
926
+ ) = H2LibSignatures._get_number_of_bodies_and_constraints(
870
927
  self, nbdy, ncst, error_code, check_stop=False
871
928
  )[
872
929
  0
@@ -894,7 +951,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
894
951
 
895
952
  nelem = np.zeros((nbdy, ), dtype=np.int64, order="F")
896
953
  error_code = -1
897
- _, nelem, error_code = H2LibSignatures.get_number_of_elements(
954
+ _, nelem, error_code = H2LibSignatures._get_number_of_elements(
898
955
  self, nbdy, nelem, error_code, check_stop=False
899
956
  )[0]
900
957
 
@@ -947,7 +1004,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
947
1004
  r12,
948
1005
  tes,
949
1006
  error_code,
950
- ) = H2LibSignatures.get_timoshenko_location(
1007
+ ) = H2LibSignatures._get_timoshenko_location(
951
1008
  self, ibdy + 1, ielem + 1, l, r1, r12, tes, error_code, check_stop=False)[0]
952
1009
  if error_code > 0:
953
1010
  raise _ERROR_CODES[error_code]
@@ -977,7 +1034,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
977
1034
  """
978
1035
  amat = np.zeros((3, 3), order="F")
979
1036
  error_code = -1
980
- _, amat, error_code = H2LibSignatures.get_body_rotation_tensor(
1037
+ _, amat, error_code = H2LibSignatures._get_body_rotation_tensor(
981
1038
  self, ibdy + 1, amat, error_code, check_stop=False)[0]
982
1039
  if error_code > 0:
983
1040
  raise _ERROR_CODES[error_code]
@@ -1017,7 +1074,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
1017
1074
  error_code = -1
1018
1075
 
1019
1076
  _, body_mass, body_inertia, cog_global_frame, cog_body_frame, error_code = (
1020
- H2LibSignatures.body_output_mass(
1077
+ H2LibSignatures._body_output_mass(
1021
1078
  self,
1022
1079
  ibdy + 1,
1023
1080
  body_mass,
@@ -1063,7 +1120,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
1063
1120
  stiffness = np.zeros_like(mass)
1064
1121
  damping = np.zeros_like(mass)
1065
1122
  error_code = -1
1066
- _, _, mass, stiffness, damping, error_code = H2LibSignatures.body_output_element(
1123
+ _, _, mass, stiffness, damping, error_code = H2LibSignatures._body_output_element(
1067
1124
  self,
1068
1125
  ibdy + 1,
1069
1126
  ielem + 1,
@@ -1115,7 +1172,7 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
1115
1172
  R = np.zeros((n_tdofs, n_rdofs), dtype=np.float64, order="F")
1116
1173
  error_code = -1
1117
1174
 
1118
- _, _, M, C, K, R, error_code = H2LibSignatures.get_system_matrices(
1175
+ _, _, M, C, K, R, error_code = H2LibSignatures._get_system_matrices(
1119
1176
  self, n_tdofs, n_rdofs, M, C, K, R, error_code, check_stop=False)[0]
1120
1177
 
1121
1178
  if error_code > 0:
@@ -1123,19 +1180,48 @@ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
1123
1180
  return M, C, K, R
1124
1181
 
1125
1182
  def get_no_mainbodies(self):
1126
- return H2LibSignatures.get_number_of_mainbodies(self, restype=np.int64)[1]
1183
+ return H2LibSignatures._get_number_of_mainbodies(self, restype=np.int64)[1]
1127
1184
 
1128
1185
  def get_mainbody_name_dict(self):
1129
1186
  s = " " * 256
1130
- return {H2LibSignatures.get_mainbody_name(self, mainbody_nr=int(i), mainbody_name=s)[0][1].strip(): i
1187
+ return {H2LibSignatures._get_mainbody_name(self, mainbody_nr=int(i), mainbody_name=s)[0][1].strip(): i
1131
1188
  for i in np.arange(self.get_no_mainbodies()) + 1}
1132
1189
 
1133
1190
  def get_mainbody_position_orientation(self, mainbody_nr, mainbody_coo_nr=0):
1134
1191
  mbdy_pos = np.zeros(3, dtype=np.float64, order="F")
1135
1192
  mbdy_tbg = np.zeros((3, 3), dtype=np.float64, order="F")
1136
- return H2Lib_DistributedSections.get_mainbody_position_orientation(
1193
+ return H2Lib_DistributedSections._get_mainbody_position_orientation(
1137
1194
  self, int(mainbody_nr), mbdy_pos, mbdy_tbg, int(mainbody_coo_nr))[0][1:-1]
1138
1195
 
1196
+ def get_mainbody_nodes_state(self, mainbody_nr, state, mainbody_coo_nr=0):
1197
+ """Return the state (pos, vel or acc) of mainbody nodes
1198
+ Note, the state refers to the structural nodes at the elastic axis
1199
+
1200
+ Parameters
1201
+ ----------
1202
+ mainbody_nr : int
1203
+ Index of mainbody (can be obtained from get_mainbody_name_dict())
1204
+ state : {'pos','vel','acc'}
1205
+ state type (position, velocity, acceleration) to compute
1206
+ mainbody_coo_nr : int, optional
1207
+ Specifies the coodinate system of the returned position and orientation.
1208
+ If 0 (default), the output is in global coordinates
1209
+ Otherwise the output is transformed to the coordinate system of the mainbody with the specified index.
1210
+ The index can be obtained from get_mainbody_name_dict
1211
+
1212
+
1213
+ Returns
1214
+ -------
1215
+ state : array_like
1216
+ state data shape=(no_nodes,3) containing the (x,y,z) position, velocity or acceleration of the nodes
1217
+
1218
+ """
1219
+ state = ['pos', 'vel', 'acc'].index(state) + 1
1220
+ nnodes = H2LibSignatures._get_mainbody_nnodes(self, int(mainbody_nr), restype=int)[1]
1221
+ nodes_state = np.zeros((nnodes, 3), dtype=np.float64, order="F")
1222
+ return H2LibSignatures._get_mainbody_nodes_state(
1223
+ self, int(mainbody_nr), int(state), int(nnodes), int(mainbody_coo_nr), nodes_state)[0][-1]
1224
+
1139
1225
 
1140
1226
  @contextmanager
1141
1227
  def set_LD_LIBRARY_PATH():
h2lib/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is autogenerated and should not be modified manually
2
- __version__ = '13.2.702'
3
- h2lib_version = '13.2.702'
4
- hawc2_version = '13.2.7+4-gb779ee7'
2
+ __version__ = '13.2.801'
3
+ h2lib_version = '13.2.801'
4
+ hawc2_version = '13.2.8'