Beijing Institute of Technology | Ming-Jian Li
The following APDL code is a companion code for the course on Artificial Intelligence and Simulation Science. Its function is to perform geometric modeling, meshing, and deformation solution for a diamond ring. The following code needs to be executed in ANSYS, APDL is the parameteric language of ANSYS.
1fini
2/clear
3/FILNAME,diamond,1
4/PREP7
5ET,1,solid285
6!mp
7mp,ex,1,1e12
8mp,prxy,1,0.2
9mp,ex,2,1.6e11
10mp,prxy,2,0.3
11!size
12r=0.01
13h1=0.005
14h2=0.01
15n=16
16rring=0.015
17wdring=r
18!points
19csys,1
20*do,i,1,n,1
21 k,i,r,i*360/n,0
22*enddo
23csys,0
24k,n+1,0,0,h1
25k,n+2,0,0,-h2
26!areas
27*do,i,1,n-1,1
28 a,i,i+1,n+1
29 a,i,i+1,n+2
30*enddo
31a,1,n,n+1
32a,1,n,n+2
33!volu
34asel,all
35va,all
36!=cutTop
37block,-r,r,-r,r,h1,h1*0.5
38vsbv,1,2
39numcmp,all
40!cutCylinder
41wpoffs,0,0,-rring-h2*0.5
42wprota,0,0,90
43cylind,rring,0,-wdring/2,wdring/2,0,360
44vsbv,1,2,,,keep
45numcmp,all
46cylind,rring*0.85,0,-wdring/2,wdring/2,0,360
47vsbv,all,3
48numcmp,all
49wprota,0,0,-90
50wpoffs,0,0,rring+h2*0.5
51!glue
52vglue,all
53numcmp,all
54!mesh
55TYPE,1
56MAT,1
57MSHKEY,0
58vmesh,1
59alls
60TYPE,1
61MAT,2
62MSHKEY,0
63vmesh,2
64alls
65!solve
66/sol
67!BC
68!fixed
69nsel,s,loc,z,h1*0.5
70d,all,ux,0
71d,all,uy,0
72d,all,uz,0
73alls
74!force
75local,11,1,0,0,-rring-h2*0.5,0,0,90
76csys,11
77nsel,s,loc,x,rring*0.85
78nsel,r,loc,y,-20,20
79csys,0
80sf,all,pres,998
81alls
82/sol
83solve
The mesh is as follows.