forked from compmech/structmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringer.py
More file actions
82 lines (65 loc) · 2.58 KB
/
Copy pathstringer.py
File metadata and controls
82 lines (65 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
Stringer (:mod:`structmanager.structelem.stringer`)
================================================
.. currentmodule:: structmanager.structelem.stringer
"""
import numpy as np
from .base import SE1D
class Stringer(SE1D):
"""Stringer
Each cross-section (profile) dimension is defined according do the PBARL
entry of Nastran's Quick Reference Guide.
Attributes
----------
profile (`str`)
- `Z_t` - Z section defined with one variable:
- `t` (variable): profile thickness
- `b` (constant): flange width
- `h` (constant): height
- `Z_t_b` - Z section defined with two variables:
- `t` (variable): profile thickness
- `b` (variable): flange width
- `h` (constant): height
- `Z_t_b_h` - Z section defined with three variables:
- `t` (variable): profile thickness
- `b` (variable): flange width
- `h` (variable): height
- `Z_tf_tw_b_h` - Z section defined with four variables:
- `tf` (variable): flange thickness
- `tw` (variable): web thickness
- `b` (variable): flange width
- `h` (variable): height
- `B_t` - Blade section defined with one variable:
- `t` (variable): thickness
- `h` (constant): height
- `L` (constant): length
- `B_t_h` - Blade section defined with two variables:
- `t` (variable): thickness
- `h` (variable): height
- `L` (constant): length
The stringer's attributes will vary from one `profile` to another.
"""
def __init__(self, name, *eids):
super(Stringer, self).__init__(name, *eids)
self.profile = 'B_t'
# optimization constraints
self.all_constraints += ['buckling']
self.constraints['buckling'] = 1
if self.elements is not None:
# reading L from FE data
# - taking the distance between the two farthest nodes
nodes = []
for element in self.elements:
for node in element.nodes:
nodes.append(node)
self.nodes = set(nodes)
ccoords = np.array([n.xyz for n in self.nodes])
xs = ccoords[:, 0]
ys = ccoords[:, 1]
zs = ccoords[:, 2]
#TODO use scipy.spatial.distance.pdist instead
dist = np.subtract.outer(xs, xs)**2
dist += np.subtract.outer(ys, ys)**2
dist += np.subtract.outer(zs, zs)**2
dist **= 0.5
self.L = dist.max()