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 +0 -0
- h2lib/_h2lib.py +155 -69
- h2lib/_version.py +3 -3
- h2lib/distributed_sections.py +27 -9
- h2lib/h2lib_signatures.py +105 -172
- {h2lib-13.2.702.dist-info → h2lib-13.2.801.dist-info}/METADATA +2 -2
- h2lib-13.2.801.dist-info/RECORD +11 -0
- h2lib-13.2.702.dist-info/RECORD +0 -11
- {h2lib-13.2.702.dist-info → h2lib-13.2.801.dist-info}/WHEEL +0 -0
- {h2lib-13.2.702.dist-info → h2lib-13.2.801.dist-info}/top_level.txt +0 -0
h2lib/distributed_sections.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from h2lib.h2lib_signatures import H2LibSignatures
|
2
2
|
import numpy as np
|
3
3
|
from enum import Enum
|
4
|
+
import sys
|
4
5
|
|
5
6
|
|
6
7
|
class DistributedSections():
|
@@ -41,11 +42,12 @@ class H2Lib_DistributedSections(H2LibSignatures):
|
|
41
42
|
add_distributed_sections and before first call to get_distributed_sections,
|
42
43
|
get_distributed_section_position_orientation and set_distributed_section_force_and_moment
|
43
44
|
"""
|
45
|
+
assert getattr(self, 'distributed_sections_initialized', False) is False
|
44
46
|
mbdy_name_dict = self.get_mainbody_name_dict()
|
45
47
|
assert mainbody_name in mbdy_name_dict, f"'{mainbody_name}' does not exist. Valid names are {list(mbdy_name_dict.keys())}."
|
46
48
|
mbdy_nr = mbdy_name_dict[mainbody_name]
|
47
49
|
nsec = len(section_relative_position)
|
48
|
-
link_id = H2LibSignatures.
|
50
|
+
link_id = H2LibSignatures._add_distributed_sections(
|
49
51
|
self,
|
50
52
|
mainbody_nr=int(mbdy_nr),
|
51
53
|
nsec=nsec,
|
@@ -60,7 +62,8 @@ class H2Lib_DistributedSections(H2LibSignatures):
|
|
60
62
|
add_distributed_sections and before first call to get_distributed_sections,
|
61
63
|
get_distributed_section_position_orientation and set_distributed_section_force_and_moment
|
62
64
|
"""
|
63
|
-
|
65
|
+
self.distributed_sections_initialized = True
|
66
|
+
return H2LibSignatures._initialize_distributed_sections(self)
|
64
67
|
|
65
68
|
def get_distributed_sections(self, link_type: LinkType, link_id):
|
66
69
|
"""Return a DistributedSections link object (needed for get_distributed_section_position_orientation
|
@@ -79,17 +82,26 @@ class H2Lib_DistributedSections(H2LibSignatures):
|
|
79
82
|
-------
|
80
83
|
DistributedSections object
|
81
84
|
"""
|
82
|
-
mbdy_nr, nsec = H2LibSignatures.
|
85
|
+
mbdy_nr, nsec = H2LibSignatures._get_distributed_sections(
|
83
86
|
self, link_type.value, link_id, mainbody_nr=0, nsec=0)[0][2:]
|
84
87
|
mbdy_name_dict = self.get_mainbody_name_dict()
|
85
88
|
mbdy_name = {nr: name for name, nr in mbdy_name_dict.items()}[mbdy_nr]
|
86
89
|
return DistributedSections(mbdy_name, link_type, link_id, nsec)
|
87
90
|
|
88
91
|
def get_distributed_section_position_orientation(self, ds: DistributedSections, mainbody_coo_nr=0):
|
89
|
-
"""
|
92
|
+
"""Computes the position and orientation of a set of distributed sections.
|
93
|
+
Note, the distributed sections are located on the c2def (aeroload/blade sections have a chord/4 offset
|
94
|
+
relative to c2def
|
95
|
+
|
90
96
|
Parameters
|
91
97
|
----------
|
92
98
|
ds : DistributedSections
|
99
|
+
reference to distributed sections as returned from add_distributed_sections or get_distributed_sections
|
100
|
+
mainbody_coo_nr : int, optional
|
101
|
+
Specifies the coodinate system of the returned position and orientation.
|
102
|
+
If 0 (default), the output is in global coordinates
|
103
|
+
Otherwise the output is transformed to the coordinate system of the mainbody with the specified index.
|
104
|
+
The index can be obtained from get_mainbody_name_dict
|
93
105
|
|
94
106
|
Returns
|
95
107
|
-------
|
@@ -100,11 +112,11 @@ class H2Lib_DistributedSections(H2LibSignatures):
|
|
100
112
|
"""
|
101
113
|
sec_pos = np.zeros((ds.nsec, 3), dtype=np.float64, order="F")
|
102
114
|
sec_ori = np.zeros((ds.nsec, 3, 3), dtype=np.float64, order="F")
|
103
|
-
return H2LibSignatures.
|
115
|
+
return H2LibSignatures._get_distributed_section_position_orientation(
|
104
116
|
self, int(ds.link_type.value), int(ds.link_id), int(ds.nsec), sec_pos, sec_ori,
|
105
117
|
int(mainbody_coo_nr))[0][3:-1]
|
106
118
|
|
107
|
-
def set_distributed_section_force_and_moment(self, ds: DistributedSections, sec_frc, sec_mom):
|
119
|
+
def set_distributed_section_force_and_moment(self, ds: DistributedSections, sec_frc, sec_mom, mainbody_coo_nr=0):
|
108
120
|
"""Set forces and moments at distributed sections
|
109
121
|
|
110
122
|
Parameters
|
@@ -115,15 +127,21 @@ class H2Lib_DistributedSections(H2LibSignatures):
|
|
115
127
|
Section forces pr. length [N/m] in global coordinates, shape=(nsec,3)
|
116
128
|
sec_momc : array_like
|
117
129
|
Section moments pr. length [Nm/m] in global coordinates, shape=(nsec,3)
|
130
|
+
mainbody_coo_nr : int, optional
|
131
|
+
Specifies the coodinate system of the provided forces and moments.
|
132
|
+
If 0 (default), the forces and moments are in global coordinates
|
133
|
+
Otherwise the index of the mainbody in which coordinate system, the forces and moments are provided
|
134
|
+
The index can be obtained from get_mainbody_name_dict
|
118
135
|
"""
|
136
|
+
assert getattr(self, 'distributed_sections_initialized',
|
137
|
+
False) is True, "Call initialize_distributed_sections before set_distributed_section_force_and_moment"
|
119
138
|
sec_frc = np.asfortranarray(sec_frc, dtype=np.float64)
|
120
139
|
sec_mom = np.asfortranarray(sec_mom, dtype=np.float64)
|
121
140
|
assert sec_frc.shape == (ds.nsec, 3)
|
122
141
|
assert sec_mom.shape == (ds.nsec, 3)
|
123
|
-
|
124
|
-
return H2LibSignatures.set_distributed_section_force_and_moment(
|
142
|
+
return H2LibSignatures._set_distributed_section_force_and_moment(
|
125
143
|
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)
|
144
|
+
frc_g=sec_frc, mom_g=sec_mom, mainbody_coo_nr=int(mainbody_coo_nr))
|
127
145
|
|
128
146
|
def set_fsi_loads_h2lib(self, fx, fy, fz, mx, my, mz): # pragma: no cover
|
129
147
|
"""Temporary function needed to replicate results of the cpl coupling framework"""
|