-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNPRES.mac
83 lines (71 loc) · 2.32 KB
/
NPRES.mac
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
82
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
! NPRES.mac
! Description: this macro applys a traction to nodes
! as described by the PressureSpaceFunction
! Preconditions:
! Elements For NPRES are already selected
! PressureSpaceFunction results is macro that sets
! Pz,Py,Pz based on Location X,Y,Z
! ie (Pz,Py,Pz) = Function(X,Y,Z)
!======================================================
_save
*vget,Elems,ELEM,,ELIST
*get,numElem,elem,,count
*do,elemIdx,1,numElem
! Get area and centroid
eNumber = Elems(elemIdx)
*get,A,elem,eNumber,area !Area
*get,X,elem,eNumber,cent,X !X Location
*get,Y,elem,eNumber,cent,Y !Y Locatoin
*get,Z,elem,eNumber,cent,Z !Z Location
Px = 0 $ Py = 0 $ Pz = 0
PressureSpaceFunction
Fx = Px*A $ Fy = Py*A $ Fz = Pz*A
!Get Number of Nodes on Element
nCount,eNumber ! Assigns count
! Depending nodes
*if,count,eq,3,or,count,eq,4,then
! Devide Load over nodes
*do,i,1,count
nodeNumber = NELEM(eNumber,i)
*GET,Fxx,node,nodeNumber,F,Fx
*GET,Fyy,node,nodeNumber,F,Fy
*GET,Fzz,node,nodeNumber,F,Fz
F,nodeNumber,Fx,Fxx+Fx/count
F,nodeNumber,Fy,Fyy+Fy/count
F,nodeNumber,Fz,Fzz+Fz/count
*enddo
*elseif,count,eq,6,then ! TRI6's
nds = $ *dim,nds,array,3
nds(1) = NELEM(eNumber,5), NELEM(eNumber,6), NELEM(eNumber,8)
*do,i,1,3
*GET,Fxx,node,nds(i),F,Fx
*GET,Fyy,node,nds(i),F,Fy
*GET,Fzz,node,nds(i),F,Fz
F,nds(i),Fx,Fxx+Fx/3
F,nds(i),Fy,Fyy+Fy/3
F,nds(i),Fz,Fzz+Fz/3
*enddo
*elseif,count,eq,8,then ! Quad 8's
*do,i,1,4
nodeNumber = NELEM(eNumber,i)
*GET,Fxx,node,nodeNumber,F,Fx
*GET,Fyy,node,nodeNumber,F,Fy
*GET,Fzz,node,nodeNumber,F,Fz
F,nodeNumber,Fx,Fxx+Fx/12
F,nodeNumber,Fy,Fyy+Fy/12
F,nodeNumber,Fz,Fzz+Fz/12
*enddo
*do,i,5,8
nodeNumber = NELEM(eNumber,i)
*GET,Fxx,node,nodeNumber,F,Fx
*GET,Fyy,node,nodeNumber,F,Fy
*GET,Fzz,node,nodeNumber,F,Fz
F,nodeNumber,Fx,Fxx+Fx/3
F,nodeNumber,Fy,Fyy+Fy/3
F,nodeNumber,Fz,Fzz+Fz/3
*enddo
*endif
*enddo
!======THE--END========THE--END========THE--END========
!ITS THE END OF THE PROGRAM AS WE KNOW IT AND I FEEL FINE