-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_nozzle.py
74 lines (48 loc) · 1.57 KB
/
simple_nozzle.py
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
import time
import numpy as np
from stl import STL
from ffd_axisymmetric import Body, Shell
from geometry import Geometry
start_time = time.time()
plug = STL('nozzle/plug.stl')
cowl = STL('nozzle/cowl.stl')
print "STL Load Time: ", time.time()-start_time
start_time = time.time()
n_c = 10
body = Body(plug, controls=n_c, x_ref=10) #just makes n_C evenly spaced points
shell = Shell(cowl, cowl.copy(), n_c, n_c)
print "Bspline Compute Time: ", time.time()-start_time
start_time = time.time()
geom = Geometry()
geom.add(body,name="plug")
geom.add(shell,name="cowl")
orig_points = geom.points.copy()
print "Geometry Object Building: ", time.time()-start_time
start_time = time.time()
deltaC_x = np.zeros((n_c,))
deltaC_r = np.zeros((n_c,))
# deltaC_x[3:] = 2 #second to last element, set to 10
deltaC = np.array(zip(deltaC_x,deltaC_r))
geom.deform(plug=deltaC)
deltaC_cx = np.zeros((n_c,))
deltaC_cr = np.zeros((n_c,))
# deltaC_cr[:] = 3 #second to last element, set to 10
deltaC_c = np.array(zip(deltaC_cx,deltaC_cr))
deltaC_tx = np.zeros((n_c,))
deltaC_tr = np.zeros((n_c,))
# deltaC_tr[:-1] = 1 #second to last element, set to 10
deltaC_t = np.array(zip(deltaC_tx,deltaC_tr))
geom.deform(cowl=(deltaC_c,deltaC_t))
print "Run Time: ", time.time()-start_time
start_time = time.time()
geom.writeSTL('new.stl', ascii=False)
print "STL Write Time: ", time.time()-start_time
start_time = time.time()
geom.writeFEPOINT('new.fepoint')
import pylab as p
profile = geom.project_profile()
for point_set in profile:
X = point_set[:,0]
Y = point_set[:,1]
p.plot(X,Y)
p.show()