Parameteric modeling of complex geometryBeijing 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.
1fini2/clear3/FILNAME,diamond,1 4/PREP7 5ET,1,solid2856!mp7mp,ex,1,1e128mp,prxy,1,0.29mp,ex,2,1.6e11 10mp,prxy,2,0.311!size12r=0.0113h1=0.00514h2=0.0115n=1616rring=0.01517wdring=r18!points19csys,120*do,i,1,n,121 k,i,r,i*360/n,022*enddo23csys,024k,n+1,0,0,h125k,n+2,0,0,-h226!areas27*do,i,1,n-1,128 a,i,i+1,n+129 a,i,i+1,n+230*enddo31a,1,n,n+132a,1,n,n+233!volu34asel,all35va,all36!=cutTop37block,-r,r,-r,r,h1,h1*0.538vsbv,1,239numcmp,all40!cutCylinder41wpoffs,0,0,-rring-h2*0.542wprota,0,0,9043cylind,rring,0,-wdring/2,wdring/2,0,36044vsbv,1,2,,,keep45numcmp,all46cylind,rring*0.85,0,-wdring/2,wdring/2,0,36047vsbv,all,348numcmp,all49wprota,0,0,-9050wpoffs,0,0,rring+h2*0.551!glue52vglue,all53numcmp,all54!mesh55TYPE,1 56MAT,157MSHKEY,058vmesh,159alls60TYPE,1 61MAT,262MSHKEY,063vmesh,264alls65!solve66/sol67!BC68!fixed69nsel,s,loc,z,h1*0.570d,all,ux,071d,all,uy,072d,all,uz,073alls74!force75local,11,1,0,0,-rring-h2*0.5,0,0,9076csys,1177nsel,s,loc,x,rring*0.8578nsel,r,loc,y,-20,2079csys,080sf,all,pres,99881alls82/sol83solveThe mesh is as follows.
