Skip to content
Snippets Groups Projects
Commit 9355ae3c authored by rosmal's avatar rosmal
Browse files

py3, circumvent if no webs present

parent b9a2765d
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ class FINSTRIPWrapperBlade(FINSTRIPWrapper):
# use BECAS cross section properties or not
self.use_becas_stiffness = False
for k, w in kwargs.iteritems():
for k, w in kwargs.items():
try:
setattr(self, k, w)
except:
......@@ -140,7 +140,7 @@ class FINSTRIPWrapperBlade(FINSTRIPWrapper):
out_str.append('%s, %0.2f' % (var_name, var_value) + n)
# write materials
mat_names = self.cs2d['materials'].keys()
mat_names = list(self.cs2d['materials'].keys())
matprops = self.cs2d['matprops']
def _write_iso(out_str, n, label, E1, nu12, rho):
......@@ -372,21 +372,29 @@ class FINSTRIPWrapperBlade(FINSTRIPWrapper):
# actual amount of webs in post processing files can differ from input
# NOTE: if the flatback web is oriented such that it closes the cross section,
# then it is identified as if the web was part of the surface
# If only a closed shape without real shear web is processed, the code
# herafter crashes, needs to be fixed to handle circular shape at root
self.nweb = len(idxs[1:])
self.nnode_web = []
for w in range(self.nweb):
self.nnode_web.append(idxs[w + 1] - idxs[w] + 1)
if self.nweb > 0: # circumvent if no webs are present
self.nnode_web = []
for w in range(self.nweb):
self.nnode_web.append(idxs[w + 1] - idxs[w] + 1)
self.nnode_web_max = np.max(np.array(self.nnode_web))
self.node_loc_web = np.zeros(
(self.nweb, self.nnode_web_max, 2))
for w in range(self.nweb):
self.node_loc_web[
w, :self.nnode_web[w] - 1, :] = self.mode_shape[0, 0, idxs[w] + 1:idxs[w + 1] + 1, :2]
# add second node of last element
self.node_loc_web[w, self.nnode_web[w] - 1, :] = self.mode_shape[
0, 0, idxs[w + 1], 2:4]
self.nnode_web_max = np.max(np.array(self.nnode_web))
self.node_loc_web = np.zeros(
(self.nweb, self.nnode_web_max, 2))
for w in range(self.nweb):
self.node_loc_web[
w, :self.nnode_web[w] - 1, :] = self.mode_shape[0, 0, idxs[w] + 1:idxs[w + 1] + 1, :2]
# add second node of last element
self.node_loc_web[w, self.nnode_web[w] - 1, :] = self.mode_shape[
0, 0, idxs[w + 1], 2:4]
else:
self.nnode_web = [0]
self.nnode_web_max = 0
self.node_loc_web = np.zeros(
(self.nweb, self.nnode_web_max, 2))
# obtain surface displacements
self.node_u_surf = np.zeros(
......@@ -398,14 +406,18 @@ class FINSTRIPWrapperBlade(FINSTRIPWrapper):
:, :, -1, :] = self.mode_shape[:, :, idxs[0], 6:]
# obtain web displacements
self.node_u_web = np.zeros(
(self.ncase, self.nweb, self.nmode, self.nnode_web_max, 2))
for w in range(self.nweb):
self.node_u_web[
:, w, :, :self.nnode_web[w] - 1, :] = self.mode_shape[:, :, idxs[w] + 1:idxs[w + 1] + 1, 4:6]
# add second node of last element
self.node_u_web[:, w, :, self.nnode_web[w] - 1, :] = self.mode_shape[
:, :, idxs[w + 1], 6:]
if self.nweb > 0: # circumvent if no webs are present
self.node_u_web = np.zeros(
(self.ncase, self.nweb, self.nmode, self.nnode_web_max, 2))
for w in range(self.nweb):
self.node_u_web[
:, w, :, :self.nnode_web[w] - 1, :] = self.mode_shape[:, :, idxs[w] + 1:idxs[w + 1] + 1, 4:6]
# add second node of last element
self.node_u_web[:, w, :, self.nnode_web[w] - 1, :] = self.mode_shape[
:, :, idxs[w + 1], 6:]
else:
self.node_u_web = np.zeros(
(self.ncase, self.nweb, self.nmode, self.nnode_web_max, 2))
plot = False
if plot:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment