-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
56 lines (36 loc) · 1.05 KB
/
test.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
from sapy import displmethod
from sapy import element
from sapy import gmsh
from sapy import structure
from sapy import plotter
import matplotlib.pyplot as plt
import random
import trussAnalyzer
import truss
def pV(maxLoad, totalLength):
return -1*maxLoad / totalLength
mesh_file = 'patch20'
bound = {0: [1, 0],
1: [1, 1]}
mesh = gmsh.Parse(mesh_file)
ele = element.Data()
for i in range(25):
ele.E[i] = 100.
ele.A[i] = 10.
ele.TYPE[i] = 'Truss'
loadNode = 3
model = structure.Builder(mesh, ele, bound)
maxLoad = trussAnalyzer.findMaxLoad(mesh, model, ele, loadNode, 0, 10, -100)
print(maxLoad)
nodal_load = {loadNode: [0, -10]}
U, Q = displmethod.solver(mesh, model, ele, nodal_load)
trus= truss.truss(model.XYZ, model.CON, Q)
print(trus.failed)
print(trus.lengths)
print(trus.totalLength)
#print('Broken member: ' + str(trus.findBroken()+1))
print('Performance rating: ' + str(pV(maxLoad, trus.totalLength)))
plotter.axialforce(model, Q)
#plotter.undeformed(model)
#plotter.deformed(model, U)
plt.show()