h2lib 13.2.201__py3-none-win_amd64.whl → 13.2.701__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
@@ -7,11 +7,12 @@ import sys
7
7
  from multiclass_interface.multiprocess_interface import MultiProcessClassInterface, ProcessClass
8
8
  import numpy as np
9
9
  from pathlib import Path
10
+ from h2lib.distributed_sections import H2Lib_DistributedSections
10
11
 
11
12
  _ERROR_CODES = {
12
13
  1: ValueError("WRONG_NUMBER_OF_COLUMNS"),
13
14
  2: ValueError("MAIN_BODY_NOT_FOUND"),
14
- 3: RuntimeError("NOT_IMPLEMENTED_ERROR"),
15
+ 3: NotImplementedError(),
15
16
  4: RuntimeError("STRUCTURE_IS_CONFIDENTIAL"),
16
17
  5: IndexError("BODY_DOES_NOT_EXIST"),
17
18
  6: IndexError("ELEMENT_DOES_NOT_EXIST"),
@@ -30,12 +31,7 @@ _ERROR_CODES = {
30
31
  }
31
32
 
32
33
 
33
- def H2Lib(suppress_output=False, subprocess=True, cwd='.'):
34
- H2 = [H2LibThread, H2LibProcess][subprocess]
35
- return H2(suppress_output=suppress_output, cwd=cwd)
36
-
37
-
38
- class H2LibThread(H2LibSignatures, DLLWrapper):
34
+ class H2LibThread(DLLWrapper, H2Lib_DistributedSections, H2LibSignatures):
39
35
  _model_path = '.'
40
36
  _aero_sections_data_shape = {}
41
37
 
@@ -170,6 +166,14 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
170
166
  self.time = np.round(H2LibSignatures.step(self, restype=np.float64)[1], 6)
171
167
  return self.time
172
168
 
169
+ def predict(self): # pragma: no cover
170
+ """Temporary functions to reproduce results from old cpl coupling"""
171
+ self.get_lib_function('step_predict_hawc2')()
172
+
173
+ def correct(self): # pragma: no cover
174
+ """Temporary functions to reproduce results from old cpl coupling"""
175
+ self.get_lib_function('step_correct_hawc2')()
176
+
173
177
  def run(self, time):
174
178
  self.time = np.round(H2LibSignatures.run(self, np.float64(time), restype=np.float64)[1], 6)
175
179
  return self.time
@@ -697,6 +701,57 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
697
701
  assert np.all(np.isfinite(uvw)), "uvw passed to h2lib.set_windfield contains nan or inf"
698
702
  return H2LibSignatures.set_windfield(self, uvw, np.float64(box_offset_x), np.float64(time))
699
703
 
704
+ def set_c2_def(
705
+ self, main_body_name, c2_def, twist_in_deg=True, check_length=True
706
+ ):
707
+ """
708
+ Set c2_def, which defines the centerline of the specified main body.
709
+
710
+ Parameters
711
+ ----------
712
+ main_body_name : str
713
+ 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.
716
+ The number of rows, i.e. sections, must match the ones in the original c2_def.
717
+ twist_in_deg : bool, optional
718
+ `True` if the twist (last column in c2_def) is given in [deg].
719
+ `False` if it is given in [rad]. The default is `True`.
720
+ check_length : bool, optional
721
+ `True` if the new beam length needs to be checked, `False` otherwise. The default is `False`.
722
+
723
+ Raises
724
+ ------
725
+ ValueError
726
+ Can be due to:
727
+ - MAIN_BODY_NOT_FOUND: none of the main bodies is called `main_body_name`.
728
+ - TOO_FEW_SECTIONS_IN_C2DEF: `c2_def` must have at least 2 sections, i.e. rows.
729
+ - BEAM_TOO_SHORT: the minimum beam length is 1.0e-7.
730
+ - DIFFERENT_NSEC: this command does not allow to add or remove sections,
731
+ therefore `c2_def` must have the same number of sections as in the HAWC2 model.
732
+ NotImplementedError
733
+ Only the c2_def node distribution is supported.
734
+
735
+ Returns
736
+ -------
737
+ None.
738
+
739
+ """
740
+ error_code = -1
741
+ error_code = H2LibSignatures.set_c2_def(
742
+ self,
743
+ main_body_name,
744
+ np.asfortranarray(c2_def.astype(np.float64)),
745
+ c2_def.shape[0],
746
+ bool(twist_in_deg),
747
+ bool(check_length),
748
+ error_code,
749
+ check_stop=False,
750
+ )[0][-1]
751
+
752
+ if error_code > 0:
753
+ raise _ERROR_CODES[error_code]
754
+
700
755
  # ===================================================================================================================
701
756
  # H2rotor
702
757
  # ===================================================================================================================
@@ -928,6 +983,100 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
928
983
  raise _ERROR_CODES[error_code]
929
984
  return amat
930
985
 
986
+ def body_output_mass(self, ibdy):
987
+ """
988
+ Compute body mass properties. Wrapper of HAWC2 command `new_htc_structure / body_output_file_name`.
989
+
990
+ Parameters
991
+ ----------
992
+ ibdy : int
993
+ Body index, starting from 0.
994
+
995
+ Raises
996
+ ------
997
+ RuntimeError
998
+ If the structure is confidential.
999
+ IndexError
1000
+ If the body does not exist.
1001
+
1002
+ Returns
1003
+ -------
1004
+ body_mass : float
1005
+ Body mass [kg].
1006
+ body_inertia : (6,) ndarray
1007
+ Body inertia [Ixx, Iyy, Izz, Ixy, Ixz, Iyz] in [kg*m^2].
1008
+ cog_global_frame : (3,) ndarray
1009
+ Body center of gravity in the global frame [m].
1010
+ cog_body_frame : (3,) ndarray
1011
+ Body center of gravity in the body frame [m].
1012
+ """
1013
+ body_mass = 0.0
1014
+ body_inertia = np.zeros((6,), order="F")
1015
+ cog_global_frame = np.zeros((3,), order="F")
1016
+ cog_body_frame = np.zeros((3,), order="F")
1017
+ error_code = -1
1018
+
1019
+ _, body_mass, body_inertia, cog_global_frame, cog_body_frame, error_code = (
1020
+ H2LibSignatures.body_output_mass(
1021
+ self,
1022
+ ibdy + 1,
1023
+ body_mass,
1024
+ body_inertia,
1025
+ cog_global_frame,
1026
+ cog_body_frame,
1027
+ error_code,
1028
+ check_stop=False,
1029
+ )[0]
1030
+ )
1031
+ if error_code > 0:
1032
+ raise _ERROR_CODES[error_code]
1033
+ return body_mass, body_inertia, cog_global_frame, cog_body_frame
1034
+
1035
+ def body_output_element(self, ibdy, ielem):
1036
+ """
1037
+ Compute element matrices. Wrapper of HAWC2 command `new_htc_structure / element_matrix_output`.
1038
+
1039
+ Parameters
1040
+ ----------
1041
+ ibdy : int
1042
+ Body index, starting from 0.
1043
+ ielem : int
1044
+ Element index, starting from 0.
1045
+
1046
+ Raises
1047
+ ------
1048
+ RuntimeError
1049
+ If the structure is confidential.
1050
+ IndexError
1051
+ If the body or the element do not exist.
1052
+
1053
+ Returns
1054
+ -------
1055
+ mass : (12, 12) ndarray of float
1056
+ Mass matrix.
1057
+ stiffness : (12, 12) ndarray of float
1058
+ Mass matrix.
1059
+ damping : (12, 12) ndarray of float
1060
+ Mass matrix.
1061
+ """
1062
+ mass = np.zeros((12, 12), dtype=np.float64, order="F")
1063
+ stiffness = np.zeros_like(mass)
1064
+ damping = np.zeros_like(mass)
1065
+ error_code = -1
1066
+ _, _, mass, stiffness, damping, error_code = H2LibSignatures.body_output_element(
1067
+ self,
1068
+ ibdy + 1,
1069
+ ielem + 1,
1070
+ mass,
1071
+ stiffness,
1072
+ damping,
1073
+ error_code,
1074
+ check_stop=False,
1075
+ )[0]
1076
+ if error_code > 0:
1077
+ raise _ERROR_CODES[error_code]
1078
+ return mass, stiffness, damping
1079
+
931
1080
  def get_system_matrices(self, n_tdofs, n_rdofs):
932
1081
  """
933
1082
  Get the system structural matrices computed during the system_eigenanalysis.
@@ -973,6 +1122,20 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
973
1122
  raise _ERROR_CODES[error_code]
974
1123
  return M, C, K, R
975
1124
 
1125
+ def get_no_mainbodies(self):
1126
+ return H2LibSignatures.get_number_of_mainbodies(self, restype=np.int64)[1]
1127
+
1128
+ def get_mainbody_name_dict(self):
1129
+ s = " " * 256
1130
+ return {H2LibSignatures.get_mainbody_name(self, mainbody_nr=int(i), mainbody_name=s)[0][1].strip(): i
1131
+ for i in np.arange(self.get_no_mainbodies()) + 1}
1132
+
1133
+ def get_mainbody_position_orientation(self, mainbody_nr, mainbody_coo_nr=0):
1134
+ mbdy_pos = np.zeros(3, dtype=np.float64, order="F")
1135
+ mbdy_tbg = np.zeros((3, 3), dtype=np.float64, order="F")
1136
+ return H2Lib_DistributedSections.get_mainbody_position_orientation(
1137
+ self, int(mainbody_nr), mbdy_pos, mbdy_tbg, int(mainbody_coo_nr))[0][1:-1]
1138
+
976
1139
 
977
1140
  @contextmanager
978
1141
  def set_LD_LIBRARY_PATH():
@@ -997,6 +1160,11 @@ class H2LibProcess(ProcessClass, H2LibThread):
997
1160
  self(suppress_output=suppress_output, filename=filename, cwd=cwd)
998
1161
 
999
1162
 
1163
+ def H2Lib(suppress_output=False, subprocess=True, cwd='.', filename=None) -> H2LibThread:
1164
+ H2 = [H2LibThread, H2LibProcess][subprocess]
1165
+ return H2(suppress_output=suppress_output, cwd=cwd, filename=filename)
1166
+
1167
+
1000
1168
  def MultiH2Lib(N, filename=None, cwd='.', suppress_output=False):
1001
1169
 
1002
1170
  if not hasattr(suppress_output, '__len__'):
h2lib/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is autogenerated and should not be modified manually
2
- __version__ = '13.2.201'
3
- h2lib_version = '13.2.201'
4
- hawc2_version = '13.2.2+2-g5cd9228'
2
+ __version__ = '13.2.701'
3
+ h2lib_version = '13.2.701'
4
+ hawc2_version = '13.2.7+4-gb779ee7'
@@ -0,0 +1,131 @@
1
+ from h2lib.h2lib_signatures import H2LibSignatures
2
+ import numpy as np
3
+ from enum import Enum
4
+
5
+
6
+ class DistributedSections():
7
+ def __init__(self, name, link_type, link_id, nsec):
8
+ self.name = name
9
+ assert isinstance(link_type, LinkType)
10
+ self.link_type = link_type
11
+ self.link_id = link_id
12
+ self.nsec = nsec
13
+
14
+
15
+ class LinkType(Enum):
16
+ BODY = 0 # Distributed sections added via add_distributed_sections
17
+ BLADE = 1 # Aerodyninamic sections of rotor=1.
18
+ AERODRAG = 2 # Aerodrag sections
19
+ HYDRO = 3 # Hydroload sections
20
+ SOIL = 4 # soil sections
21
+
22
+
23
+ class H2Lib_DistributedSections(H2LibSignatures):
24
+ """Distributed sections are sections distributed along a mainbody in HAWC2.
25
+ These sections follows the structure and the position and orientation of the sections can be obtained by
26
+ get_distributed_section_position_orientation.
27
+
28
+ Furthermore, forces and moments can be set on the sections via set_distributed_section_force_and_moment
29
+
30
+ Distributed sections are used inside HAWC2 for aerodynamic loads, aerodrag, hydro, and soil.
31
+ A reference/link object to these sections can be obtained by get_distributed_sections
32
+
33
+ Moreover, custom distributed sections can be added by add_distributed_sections. Remember to call
34
+ initialize_distributed_sections between the last add_distributed_sections and the first usage.
35
+ """
36
+
37
+ def add_distributed_sections(self, mainbody_name, section_relative_position):
38
+ """Add custom distributed sections along a mainbody.
39
+
40
+ Note, that initialize_distributed_sections (see below) must be called after the last call to
41
+ add_distributed_sections and before first call to get_distributed_sections,
42
+ get_distributed_section_position_orientation and set_distributed_section_force_and_moment
43
+ """
44
+ mbdy_name_dict = self.get_mainbody_name_dict()
45
+ assert mainbody_name in mbdy_name_dict, f"'{mainbody_name}' does not exist. Valid names are {list(mbdy_name_dict.keys())}."
46
+ mbdy_nr = mbdy_name_dict[mainbody_name]
47
+ nsec = len(section_relative_position)
48
+ link_id = H2LibSignatures.add_distributed_sections(
49
+ self,
50
+ mainbody_nr=int(mbdy_nr),
51
+ nsec=nsec,
52
+ sec_rel_pos=np.asfortranarray(section_relative_position, dtype=float),
53
+ link_id=0)[0][-1]
54
+ return DistributedSections(mainbody_name, LinkType.BODY, link_id, nsec)
55
+
56
+ def initialize_distributed_sections(self):
57
+ """Initialize distributed sections added by add_distributed_sections.
58
+
59
+ Note, that this method must be called after the last call to
60
+ add_distributed_sections and before first call to get_distributed_sections,
61
+ get_distributed_section_position_orientation and set_distributed_section_force_and_moment
62
+ """
63
+ return H2LibSignatures.initialize_distributed_sections(self)
64
+
65
+ def get_distributed_sections(self, link_type: LinkType, link_id):
66
+ """Return a DistributedSections link object (needed for get_distributed_section_position_orientation
67
+ and set_distributed_section_force_and_moment).
68
+
69
+ To obtain the aerodynamic load sections at blade 3 (only rotor=1 can be accessed):
70
+ h2.get_distributed_sections(LinkType.BLADE, 3)
71
+
72
+ Parameters
73
+ ----------
74
+ link_type : LinkType
75
+ Specifies the link type. See enum LinkType
76
+ link_id : integer
77
+ index of link. link_id=1 will reference the first added sections, e.g. blade1
78
+ Returns
79
+ -------
80
+ DistributedSections object
81
+ """
82
+ mbdy_nr, nsec = H2LibSignatures.get_distributed_sections(
83
+ self, link_type.value, link_id, mainbody_nr=0, nsec=0)[0][2:]
84
+ mbdy_name_dict = self.get_mainbody_name_dict()
85
+ mbdy_name = {nr: name for name, nr in mbdy_name_dict.items()}[mbdy_nr]
86
+ return DistributedSections(mbdy_name, link_type, link_id, nsec)
87
+
88
+ def get_distributed_section_position_orientation(self, ds: DistributedSections, mainbody_coo_nr=0):
89
+ """
90
+ Parameters
91
+ ----------
92
+ ds : DistributedSections
93
+
94
+ Returns
95
+ -------
96
+ sec_pos : array(nsec,3)
97
+ sec_ori : array(nsec,3,3)
98
+ Orientation of section in specified coordinates.
99
+ For mainbody_coo_nr=0, default, the orientation is in global coordinates, i.e. Tsg
100
+ """
101
+ sec_pos = np.zeros((ds.nsec, 3), dtype=np.float64, order="F")
102
+ sec_ori = np.zeros((ds.nsec, 3, 3), dtype=np.float64, order="F")
103
+ return H2LibSignatures.get_distributed_section_position_orientation(
104
+ self, int(ds.link_type.value), int(ds.link_id), int(ds.nsec), sec_pos, sec_ori,
105
+ int(mainbody_coo_nr))[0][3:-1]
106
+
107
+ def set_distributed_section_force_and_moment(self, ds: DistributedSections, sec_frc, sec_mom):
108
+ """Set forces and moments at distributed sections
109
+
110
+ Parameters
111
+ ----------
112
+ ds : DistributedSections object
113
+ object returned by add_distributed_sections or get_distributed_sections
114
+ sec_frc : array_like
115
+ Section forces pr. length [N/m] in global coordinates, shape=(nsec,3)
116
+ sec_momc : array_like
117
+ Section moments pr. length [Nm/m] in global coordinates, shape=(nsec,3)
118
+ """
119
+ sec_frc = np.asfortranarray(sec_frc, dtype=np.float64)
120
+ sec_mom = np.asfortranarray(sec_mom, dtype=np.float64)
121
+ assert sec_frc.shape == (ds.nsec, 3)
122
+ assert sec_mom.shape == (ds.nsec, 3)
123
+
124
+ return H2LibSignatures.set_distributed_section_force_and_moment(
125
+ self, link_type=int(ds.link_type.value), link_id=int(ds.link_id), nsec=int(ds.nsec),
126
+ frc_g=sec_frc, mom_g=sec_mom)
127
+
128
+ def set_fsi_loads_h2lib(self, fx, fy, fz, mx, my, mz): # pragma: no cover
129
+ """Temporary function needed to replicate results of the cpl coupling framework"""
130
+ fx, fy, fz, mx, my, mz = [np.asfortranarray(v, dtype=np.float64) for v in [fx, fy, fz, mx, my, mz]]
131
+ self.get_lib_function('set_fsi_loads_hawc2')(fx, fy, fz, mx, my, mz)
h2lib/h2lib_signatures.py CHANGED
@@ -4,6 +4,14 @@ from h2lib.dll_wrapper import DLLWrapper
4
4
 
5
5
 
6
6
  class H2LibSignatures():
7
+ def add_distributed_sections(self, mainbody_nr, nsec, sec_rel_pos, link_id, check_stop=True):
8
+ '''subroutine add_distributed_sections(mainbody_nr, nsec, sec_rel_pos, link_id) bind(C, name="add_distributed_sections")
9
+ integer*8, intent(in) :: mainbody_nr, nsec
10
+ integer*8, intent(out) :: link_id
11
+ real(c_double), intent(in) :: sec_rel_pos(nsec)
12
+ end subroutine'''
13
+ return self.get_lib_function('add_distributed_sections')(mainbody_nr, nsec, sec_rel_pos, link_id, check_stop=check_stop)
14
+
7
15
  def add_sensor(self, sensor_line, index_start, index_stop, check_stop=True):
8
16
  '''subroutine add_sensor(sensor_line, index_start, index_stop) bind(C, name="add_sensor")
9
17
  integer*8 :: index_start, index_stop
@@ -11,6 +19,28 @@ class H2LibSignatures():
11
19
  end subroutine'''
12
20
  return self.get_lib_function('add_sensor')(sensor_line, index_start, index_stop, check_stop=check_stop)
13
21
 
22
+ def body_output_element(self, ibdy, ielem, mass, stiffness, damping, error_code, check_stop=True):
23
+ '''subroutine body_output_element(ibdy, ielem, mass, stiffness, damping, error_code) &
24
+ integer(kind=4), intent(in) :: ibdy
25
+ integer(kind=4), intent(in) :: ielem
26
+ real(kind=c_double), dimension(12, 12), intent(out) :: mass
27
+ real(kind=c_double), dimension(12, 12), intent(out) :: stiffness
28
+ real(kind=c_double), dimension(12, 12), intent(out) :: damping
29
+ integer(kind=8), intent(out) :: error_code
30
+ end subroutine'''
31
+ return self.get_lib_function('body_output_element')(ibdy, ielem, mass, stiffness, damping, error_code, check_stop=check_stop)
32
+
33
+ def body_output_mass(self, ibdy, body_mass, body_inertia, cog_global_frame, cog_body_frame, error_code, check_stop=True):
34
+ '''subroutine body_output_mass(ibdy, body_mass, body_inertia, cog_global_frame, cog_body_frame, error_code) &
35
+ integer(kind=4), intent(in) :: ibdy
36
+ real(kind=c_double), intent(out) :: body_mass
37
+ real(kind=c_double), intent(out) :: body_inertia(6)
38
+ real(kind=c_double), intent(out) :: cog_global_frame(3)
39
+ real(kind=c_double), intent(out) :: cog_body_frame(3)
40
+ integer(kind=8), intent(out) :: error_code
41
+ end subroutine'''
42
+ return self.get_lib_function('body_output_mass')(ibdy, body_mass, body_inertia, cog_global_frame, cog_body_frame, error_code, check_stop=check_stop)
43
+
14
44
  def check_convergence(self, bconv, resq, resg, resd, check_stop=True):
15
45
  '''subroutine check_convergence(bconv, resq, resg, resd) bind(C, name='check_convergence')
16
46
  logical(kind=c_bool), intent(out) :: bconv
@@ -20,8 +50,7 @@ class H2LibSignatures():
20
50
  end subroutine'''
21
51
  return self.get_lib_function('check_convergence')(bconv, resq, resg, resd, check_stop=check_stop)
22
52
 
23
- def do_system_eigenanalysis(self, include_damping, n_modes, natural_frequencies,
24
- damping_ratios, error_code, check_stop=True):
53
+ def do_system_eigenanalysis(self, include_damping, n_modes, natural_frequencies, damping_ratios, error_code, check_stop=True):
25
54
  '''subroutine do_system_eigenanalysis(include_damping, n_modes, natural_frequencies, damping_ratios, error_code) &
26
55
  logical(kind=c_bool), intent(in) :: include_damping
27
56
  integer(kind=4), intent(in) :: n_modes
@@ -29,8 +58,7 @@ real(kind=c_double), dimension(n_modes), intent(out) :: natural_frequencies
29
58
  real(kind=c_double), dimension(n_modes), intent(out) :: damping_ratios
30
59
  integer(kind=8), intent(out) :: error_code
31
60
  end subroutine'''
32
- return self.get_lib_function('do_system_eigenanalysis')(include_damping, n_modes,
33
- natural_frequencies, damping_ratios, error_code, check_stop=check_stop)
61
+ return self.get_lib_function('do_system_eigenanalysis')(include_damping, n_modes, natural_frequencies, damping_ratios, error_code, check_stop=check_stop)
34
62
 
35
63
  def echo_version(self, check_stop=True):
36
64
  '''subroutine echo_version() BIND(C, NAME='echo_version')
@@ -136,6 +164,21 @@ end subroutine'''
136
164
  end function'''
137
165
  return self.get_lib_function('get_diameter')(rotor, restype=restype, check_stop=check_stop)
138
166
 
167
+ def get_distributed_section_position_orientation(self, link_type, link_id, nsec, sec_pos, sec_ori, mainbody_coo_nr, check_stop=True):
168
+ '''subroutine get_distributed_section_position_orientation(link_type, link_id, nsec, sec_pos, sec_ori, mainbody_coo_nr) bind(C, name="get_distributed_section_position_orientation")
169
+ integer*8, intent(in) :: link_type, link_id, nsec, mainbody_coo_nr
170
+ real(c_double), intent(out) :: sec_pos(nsec,3)
171
+ real(c_double), intent(out) :: sec_ori(nsec,3,3)
172
+ end subroutine'''
173
+ return self.get_lib_function('get_distributed_section_position_orientation')(link_type, link_id, nsec, sec_pos, sec_ori, mainbody_coo_nr, check_stop=check_stop)
174
+
175
+ def get_distributed_sections(self, link_type, link_id, mainbody_nr, nsec, check_stop=True):
176
+ '''subroutine get_distributed_sections(link_type, link_id, mainbody_nr, nsec) bind(C, name="get_distributed_sections")
177
+ integer*8, intent(in) :: link_type, link_id
178
+ integer*8, intent(out) :: nsec, mainbody_nr
179
+ end subroutine'''
180
+ return self.get_lib_function('get_distributed_sections')(link_type, link_id, mainbody_nr, nsec, check_stop=check_stop)
181
+
139
182
  def get_induction_axisymmetric(self, rotor, induction, check_stop=True):
140
183
  '''subroutine get_induction_axisymmetric(rotor, induction) bind(C, name="get_induction_axisymmetric")
141
184
  integer*8, intent(in) :: rotor
@@ -158,6 +201,21 @@ end subroutine'''
158
201
  end subroutine'''
159
202
  return self.get_lib_function('get_induction_rotoravg')(rotor, induction, check_stop=check_stop)
160
203
 
204
+ def get_mainbody_name(self, mainbody_nr, mainbody_name, check_stop=True):
205
+ '''subroutine get_mainbody_name(mainbody_nr, mainbody_name) bind(C, name="get_mainbody_name")
206
+ integer*8 :: mainbody_nr
207
+ character(kind=c_char, len=1), intent(inout) :: mainbody_name(256)
208
+ end subroutine'''
209
+ return self.get_lib_function('get_mainbody_name')(mainbody_nr, mainbody_name, check_stop=check_stop)
210
+
211
+ def get_mainbody_position_orientation(self, mainbody_nr, mbdy_pos, mbdy_ori, mainbody_coo_nr, check_stop=True):
212
+ '''subroutine get_mainbody_position_orientation(mainbody_nr, mbdy_pos, mbdy_ori, mainbody_coo_nr) bind(C, name="get_mainbody_position_orientation")
213
+ integer*8, intent(in) :: mainbody_nr, mainbody_coo_nr
214
+ real(c_double), intent(out) :: mbdy_pos(3)
215
+ real(c_double), intent(out) :: mbdy_ori(3,3)
216
+ end subroutine'''
217
+ return self.get_lib_function('get_mainbody_position_orientation')(mainbody_nr, mbdy_pos, mbdy_ori, mainbody_coo_nr, check_stop=check_stop)
218
+
161
219
  def get_nSections(self, rotor, blade, restype, check_stop=True):
162
220
  '''function get_nSections(rotor, blade) bind(C, name="get_nSections")
163
221
  !DEC$ ATTRIBUTES DLLEXPORT :: get_nSections
@@ -187,8 +245,7 @@ end subroutine'''
187
245
  integer(kind=8), intent(out) :: ncst
188
246
  integer(kind=8), intent(out) :: error_code
189
247
  end subroutine'''
190
- return self.get_lib_function('get_number_of_bodies_and_constraints')(
191
- nbdy, ncst, error_code, check_stop=check_stop)
248
+ return self.get_lib_function('get_number_of_bodies_and_constraints')(nbdy, ncst, error_code, check_stop=check_stop)
192
249
 
193
250
  def get_number_of_elements(self, nbdy, nelem, error_code, check_stop=True):
194
251
  '''subroutine get_number_of_elements(nbdy, nelem, error_code) &
@@ -198,6 +255,13 @@ end subroutine'''
198
255
  end subroutine'''
199
256
  return self.get_lib_function('get_number_of_elements')(nbdy, nelem, error_code, check_stop=check_stop)
200
257
 
258
+ def get_number_of_mainbodies(self, restype, check_stop=True):
259
+ '''function get_number_of_mainbodies() bind(C, name="get_number_of_mainbodies")
260
+ !DEC$ ATTRIBUTES DLLEXPORT :: get_number_of_mainbodies
261
+ integer*8 :: get_number_of_mainbodies
262
+ end function'''
263
+ return self.get_lib_function('get_number_of_mainbodies')(restype=restype, check_stop=check_stop)
264
+
201
265
  def get_rotor_avg_wsp(self, coo, rotor, wsp, check_stop=True):
202
266
  '''subroutine get_rotor_avg_wsp(coo, rotor, wsp) bind(C, name="get_rotor_avg_wsp")
203
267
  integer*8, intent(in) :: rotor
@@ -253,8 +317,7 @@ end subroutine'''
253
317
  end subroutine'''
254
318
  return self.get_lib_function('get_stop_message')(stop_message, check_stop=check_stop)
255
319
 
256
- def get_system_eigval_eigvec_with_damping(self, n_modes, ny, eigenvalues,
257
- eigenvectors, error_code, check_stop=True):
320
+ def get_system_eigval_eigvec_with_damping(self, n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=True):
258
321
  '''subroutine get_system_eigval_eigvec_with_damping(n_modes, ny, eigenvalues, eigenvectors, error_code) &
259
322
  integer(kind=4), intent(in) :: n_modes
260
323
  integer(kind=4), intent(in) :: ny
@@ -262,11 +325,9 @@ complex(kind=c_double_complex), dimension(n_modes), intent(out) :: eigenvalues
262
325
  complex(kind=c_double_complex), dimension(ny, n_modes), intent(out) :: eigenvectors
263
326
  integer(kind=8), intent(out) :: error_code
264
327
  end subroutine'''
265
- return self.get_lib_function('get_system_eigval_eigvec_with_damping')(
266
- n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=check_stop)
328
+ return self.get_lib_function('get_system_eigval_eigvec_with_damping')(n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=check_stop)
267
329
 
268
- def get_system_eigval_eigvec_without_damping(
269
- self, n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=True):
330
+ def get_system_eigval_eigvec_without_damping(self, n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=True):
270
331
  '''subroutine get_system_eigval_eigvec_without_damping(n_modes, ny, eigenvalues, eigenvectors, error_code) &
271
332
  integer(kind=4), intent(in) :: n_modes
272
333
  integer(kind=4), intent(in) :: ny
@@ -274,8 +335,7 @@ real(kind=c_double), dimension(n_modes), intent(out) :: eigenvalues
274
335
  real(kind=c_double), dimension(ny, n_modes), intent(out) :: eigenvectors
275
336
  integer(kind=8), intent(out) :: error_code
276
337
  end subroutine'''
277
- return self.get_lib_function('get_system_eigval_eigvec_without_damping')(
278
- n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=check_stop)
338
+ return self.get_lib_function('get_system_eigval_eigvec_without_damping')(n_modes, ny, eigenvalues, eigenvectors, error_code, check_stop=check_stop)
279
339
 
280
340
  def get_system_matrices(self, n_tdofs, n_rdofs, M, C, K, R, error_code, check_stop=True):
281
341
  '''subroutine get_system_matrices(n_tdofs, n_rdofs, M, C, K, R, error_code) &
@@ -287,8 +347,7 @@ real(kind=c_double), dimension(n_rdofs, n_rdofs), intent(out) :: K
287
347
  real(kind=c_double), dimension(n_tdofs, n_rdofs), intent(out) :: R
288
348
  integer(kind=8), intent(out) :: error_code
289
349
  end subroutine'''
290
- return self.get_lib_function('get_system_matrices')(
291
- n_tdofs, n_rdofs, M, C, K, R, error_code, check_stop=check_stop)
350
+ return self.get_lib_function('get_system_matrices')(n_tdofs, n_rdofs, M, C, K, R, error_code, check_stop=check_stop)
292
351
 
293
352
  def get_time(self, time, check_stop=True):
294
353
  '''subroutine
@@ -305,8 +364,7 @@ subroutine'''
305
364
  real(kind=c_double), dimension(3,3), intent(out) :: tes
306
365
  integer(kind=8), intent(out) :: error_code
307
366
  end subroutine'''
308
- return self.get_lib_function('get_timoshenko_location')(
309
- ibdy, ielem, l, r1, r12, tes, error_code, check_stop=check_stop)
367
+ return self.get_lib_function('get_timoshenko_location')(ibdy, ielem, l, r1, r12, tes, error_code, check_stop=check_stop)
310
368
 
311
369
  def get_version(self, s, check_stop=True):
312
370
  '''subroutine get_version(s) BIND(C, NAME='get_version')
@@ -326,8 +384,7 @@ end subroutine'''
326
384
  integer*8, intent(in) :: tiploss_method
327
385
  REAL(c_double), intent(in) :: tiploss2_shen_c2, tiploss2_shen_h
328
386
  end subroutine'''
329
- return self.get_lib_function('init_AD')(rotor, tiploss_method, tiploss2_shen_c2,
330
- tiploss2_shen_h, check_stop=check_stop)
387
+ return self.get_lib_function('init_AD')(rotor, tiploss_method, tiploss2_shen_c2, tiploss2_shen_h, check_stop=check_stop)
331
388
 
332
389
  def init_AL(self, rotor, epsilon_smearing, check_stop=True):
333
390
  '''subroutine init_AL(rotor, epsilon_smearing) bind(C, name="init_AL")
@@ -341,8 +398,21 @@ end subroutine'''
341
398
  integer*8, dimension(3), intent(in) :: Nxyz
342
399
  real*8 :: transport_speed
343
400
  end subroutine'''
344
- return self.get_lib_function('init_windfield')(
345
- Nxyz, dxyz, box_offset_yz, transport_speed, check_stop=check_stop)
401
+ return self.get_lib_function('init_windfield')(Nxyz, dxyz, box_offset_yz, transport_speed, check_stop=check_stop)
402
+
403
+ def initialize_distributed_sections(self, check_stop=True):
404
+ '''subroutine initialize_distributed_sections() bind(C, name="initialize_distributed_sections")
405
+ !DEC$ ATTRIBUTES DLLEXPORT :: initialize_distributed_sections
406
+ type (TBodyLink), pointer :: bodylink
407
+ type (Tseclink),dimension(:),pointer :: seclinks
408
+ Type (Tbaselink) :: baselink
409
+ type (body_type),dimension(:),pointer :: b_vec
410
+ type (TBodySectionLink), pointer :: bsl
411
+ Type (Tmain_body_input),pointer :: mbdy
412
+ integer :: nnodes
413
+ integer :: i
414
+ end subroutine'''
415
+ return self.get_lib_function('initialize_distributed_sections')(check_stop=check_stop)
346
416
 
347
417
  def linearize(self, n_tdofs, n_rdofs, check_stop=True):
348
418
  '''subroutine linearize(n_tdofs, n_rdofs) bind(C, name="linearize")
@@ -409,32 +479,51 @@ end subroutine'''
409
479
  end subroutine'''
410
480
  return self.get_lib_function('set_aerosections_windspeed')(rotor, uvw, check_stop=check_stop)
411
481
 
412
- def set_orientation_base(self, main_body_name,
413
- n_rows, mbdy_eulerang_table, angles_in_deg, reset_orientation, mbdy_ini_rotvec_d1,
414
- error_code, check_stop=True):
415
- '''subroutine set_orientation_base(main_body_name, &
482
+ def set_c2_def(self, main_body_name, c2_def, nsec, twist_in_deg, check_length, error_code, check_stop=True):
483
+ '''subroutine set_c2_def(main_body_name, c2_def, nsec, twist_in_deg, check_length, error_code) &
484
+ character(kind=c_char, len=1), dimension(256), intent(in ) :: main_body_name ! Defined as an array of length 1 characters because of bind.
485
+ real(kind=c_double), dimension(nsec, 4), intent(in ) :: c2_def
486
+ integer(kind=4), intent(in ) :: nsec
487
+ logical(kind=c_bool), intent(in ) :: twist_in_deg
488
+ logical(kind=c_bool), intent(in ) :: check_length
489
+ integer(kind=8), intent( out) :: error_code
490
+ character(kind=c_char, len=256) :: mbdy_name ! Same as main_body_name, but as string instead of an array of characters.
491
+ type(Tmain_body_input), pointer :: main_body ! The main body whose c2_def we want to update.
492
+ type(Tc2def_input), pointer :: c2def_input ! The c2_def of main_body.
493
+ end subroutine'''
494
+ return self.get_lib_function('set_c2_def')(main_body_name, c2_def, nsec, twist_in_deg, check_length, error_code, check_stop=check_stop)
495
+
496
+ def set_distributed_section_force_and_moment(self, link_type, link_id, nsec, frc_g, mom_g, check_stop=True):
497
+ '''subroutine set_distributed_section_force_and_moment(link_type, link_id, nsec, frc_g, mom_g) bind(C, name="set_distributed_section_force_and_moment")
498
+ integer*8, intent(in) :: link_type, link_id, nsec
499
+ real(c_double), intent(in) :: frc_g(nsec,3), mom_g(nsec,3)
500
+ end subroutine'''
501
+ return self.get_lib_function('set_distributed_section_force_and_moment')(link_type, link_id, nsec, frc_g, mom_g, check_stop=check_stop)
502
+
503
+ def set_orientation_base(self, main_body_name, n_rows, mbdy_eulerang_table, angles_in_deg, reset_orientation, mbdy_ini_rotvec_d1, error_code, check_stop=True):
504
+ '''subroutine set_orientation_base(main_body_name, n_rows, mbdy_eulerang_table, angles_in_deg, reset_orientation, mbdy_ini_rotvec_d1, error_code) &
416
505
  character(kind=c_char, len=1), dimension(256), intent(in) :: main_body_name
506
+ integer(kind=4), intent(in) :: n_rows
417
507
  real(kind=c_double), dimension(n_rows, 3), intent(in) :: mbdy_eulerang_table
418
508
  logical(c_bool), intent(in) :: angles_in_deg
419
509
  logical(c_bool), intent(in) :: reset_orientation
420
510
  real(kind=c_double), dimension(4), intent(in) :: mbdy_ini_rotvec_d1
511
+ integer(kind=8), intent(out) :: error_code ! Error code.
421
512
  end subroutine'''
422
- return self.get_lib_function('set_orientation_base')(main_body_name,
423
- n_rows, mbdy_eulerang_table, angles_in_deg, reset_orientation, mbdy_ini_rotvec_d1,
424
- error_code, check_stop=check_stop)
425
-
426
- def set_orientation_relative(self, main_body_1_name, node_1, main_body_2_name, node_2,
427
- n_rows, mbdy2_eulerang_table, angles_in_deg,
428
- reset_orientation,
429
- mbdy2_ini_rotvec_d1,
430
- error_code, check_stop=True):
431
- '''subroutine set_orientation_relative(main_body_1_name, node_1, main_body_2_name, node_2, &
513
+ return self.get_lib_function('set_orientation_base')(main_body_name, n_rows, mbdy_eulerang_table, angles_in_deg, reset_orientation, mbdy_ini_rotvec_d1, error_code, check_stop=check_stop)
514
+
515
+ def set_orientation_relative(self, main_body_1_name, node_1, main_body_2_name, node_2, n_rows, mbdy2_eulerang_table, angles_in_deg, reset_orientation, mbdy2_ini_rotvec_d1, error_code, check_stop=True):
516
+ '''subroutine set_orientation_relative(main_body_1_name, node_1, main_body_2_name, node_2, n_rows, mbdy2_eulerang_table, angles_in_deg, reset_orientation, mbdy2_ini_rotvec_d1, error_code) &
432
517
  character(kind=c_char, len=1), dimension(256), intent(in ) :: main_body_1_name ! Defined as an array of length 1 characters because of bind.
433
518
  character(kind=c_char, len=1), dimension(256), intent(in ) :: main_body_2_name ! Defined as an array of length 1 characters because of bind.
434
519
  integer(kind=8), intent(in ) :: node_1
435
520
  integer(kind=8), intent(in ) :: node_2
521
+ integer(kind=4), intent(in ) :: n_rows
436
522
  real(kind=c_double), dimension(n_rows, 3), intent(in ) :: mbdy2_eulerang_table
437
523
  logical(c_bool), intent(in ) :: angles_in_deg
524
+ logical(c_bool), intent(in ) :: reset_orientation
525
+ real(kind=c_double), dimension(4), intent(in ) :: mbdy2_ini_rotvec_d1 ! Initial angular velocity direction and magnitude.
526
+ integer(kind=8), intent( out) :: error_code
438
527
  character(kind=c_char, len=256) :: mbdy_1_name ! Same as main_body_1_name, but as string instead of an array of characters.
439
528
  character(kind=c_char, len=256) :: mbdy_2_name ! Same as main_body_2_name, but as string instead of an array of characters.
440
529
  type(Tmain_body_input), pointer :: main_body_1 ! The main body pointer associated to main_body_1_name.
@@ -442,11 +531,7 @@ type(Tmain_body_input), pointer :: main_body_2 ! The main body pointer associat
442
531
  integer(kind=4) :: node_1_local, node_2_local ! Internal copy of node_1 and node_2.
443
532
  real*8, dimension(3) :: eulerang ! Euler angles associated to 1 row of mbdy2_eulerang_table.
444
533
  end subroutine'''
445
- return self.get_lib_function('set_orientation_relative')(main_body_1_name, node_1, main_body_2_name, node_2,
446
- n_rows, mbdy2_eulerang_table, angles_in_deg,
447
- reset_orientation,
448
- mbdy2_ini_rotvec_d1,
449
- error_code, check_stop=check_stop)
534
+ return self.get_lib_function('set_orientation_relative')(main_body_1_name, node_1, main_body_2_name, node_2, n_rows, mbdy2_eulerang_table, angles_in_deg, reset_orientation, mbdy2_ini_rotvec_d1, error_code, check_stop=check_stop)
450
535
 
451
536
  def set_variable_sensor_value(self, id, value, check_stop=True):
452
537
  '''subroutine set_variable_sensor_value(id, value) bind(C, name="set_variable_sensor_value")
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h2lib
3
- Version: 13.2.201
4
- Summary: Python interface to HAWC2 (13.2.2+2-g5cd9228)
3
+ Version: 13.2.701
4
+ Summary: Python interface to HAWC2 (13.2.7+4-gb779ee7)
5
5
  Download-URL:
6
6
  Author: Mads M. Pedersen, S.G.Horcas and N.G.Ramos
7
7
  Author-email: mmpe@dtu.dk
@@ -0,0 +1,11 @@
1
+ h2lib/HAWC2Lib.dll,sha256=UhEa8wYrBfkZ3f-6MQDeNOTP9ncDIkWpfj8zJ1skSfA,30628864
2
+ h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
3
+ h2lib/_h2lib.py,sha256=mA4W91BbSO2edvHzsrroVbRD_pW4axwGlwxBE9nDnkQ,45730
4
+ h2lib/_version.py,sha256=JiP-kg_iCUO5g8WQvSp95pNuU7r-swyVJphX5dw60eU,157
5
+ h2lib/distributed_sections.py,sha256=VhcYr94se4Zq8PaHg_6z6r7YjwSvbEQoxPiA25HYXBg,6233
6
+ h2lib/dll_wrapper.py,sha256=O_lGZ_w3FirjEn4FIE5OeZz30nwpufJB5sflVzf4Cc4,13446
7
+ h2lib/h2lib_signatures.py,sha256=P-9iysIIwgi18qBEUXj5X_-YFS7xt5Em4NSwfgrfDVE,36509
8
+ h2lib-13.2.701.dist-info/METADATA,sha256=evKD9QTQXimcV0tk8B3kJq5i2PrXJX89n9yjtMYwOIY,860
9
+ h2lib-13.2.701.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
10
+ h2lib-13.2.701.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
11
+ h2lib-13.2.701.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- h2lib/HAWC2Lib.dll,sha256=M6SWeBpQ32Phv7Bcj0LQhmiJdnXwWNwoNSPKtk_mpLc,30980096
2
- h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
3
- h2lib/_h2lib.py,sha256=Nxtz01N-AcMX-OZYS2-QRjuGDBVVKWopBHcxAHfjR7s,39553
4
- h2lib/_version.py,sha256=wfBRDfXJqowsNUL3qywY9qWaPyrqBIh3pXkfxk1s-vw,157
5
- h2lib/dll_wrapper.py,sha256=O_lGZ_w3FirjEn4FIE5OeZz30nwpufJB5sflVzf4Cc4,13446
6
- h2lib/h2lib_signatures.py,sha256=gHHPZ9vjwQwRA8Vb8V2gOuYBL6mZz9r_pcu7_EtzVoE,29637
7
- h2lib-13.2.201.dist-info/METADATA,sha256=YYuUvTlE3pDY7aS7STdo14Y4c-wMj1fI0Wv85hV0AzY,860
8
- h2lib-13.2.201.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
9
- h2lib-13.2.201.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
10
- h2lib-13.2.201.dist-info/RECORD,,