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 solve the vibration process of a beam with one end fixed and the other end subjected to force using the finite element method. The following code needs to be executed in ANSYS, APDL is the parameteric language of ANSYS.
x1fini
2/clear
3/FILNAME,noodle,1
4/PREP7
5/units,SI
6ET,1,solid185
7mp,EX,1,40e3
8mp,PRXY,1,0.3
9mp,DENS,1,1200
10a=0.01
11b=0.01
12c=0.7
13block,0,c,-a/2,a/2,-b/2,b/2
14LSEL,all
15LESIZE,ALL,a
16alls
17TYPE,1
18MAT,1
19vmesh,all
20alls
21/sol
22nsel,s,loc,x,0
23d,all,ux,0
24d,all,uy,0
25d,all,uz,0
26alls
27deltat=0.1
28n=100
29force=1e-4
30freq=1
31/SOL
32antype,trans
33TRNOPT,FULL
34*do,i,1,n,1
35 TIME,i*deltat
36 nsel,s,loc,x,c
37 f,all,fy,force*cos(2*3.14*freq*i*deltat)
38 alls
39 solve
40*enddo
41save
The result is as follows.