首页 新闻 搜索 专区 学院

利用C与ansys的APDL参数化语言解决复合材料的圆形颗粒网格划分问题,下面的C语言是否正确?

0
悬赏园豆:100 [待解决问题]

1 /*调用ANSYS生成网格*/

 2 void GenMesh(struct circle0 *circle,double xmax,double xmin,double ymax,double ymin)

 3 {

 4

 5     FILE* ansysfile;

 6     ansysfile=fopen("temp.inp","w");

 7

 8     fprintf(ansysfile,"/CLEAR,NOSTART\n");

 9     fprintf(ansysfile,"/PREP7\n");

10

11     //创建基体

12     fprintf(ansysfile,"RECTNG,%f,%f,%f,%f,\n",xmin,xmax,ymin,ymax);

13

14     //创建颗粒

15     for (int i=0; i<N0; i++)

16     {

17         if (circle[i].r<0.00000001)

18         {

19             continue;

20         }

21         fprintf(ansysfile,"K,%d,%f,%f\n",i+1000,

22                 circle[i].centre_x,circle[i].centre_y);

23         fprintf(ansysfile,"CIRCLE,%d,%f\n",i+1000,circle[i].r);

24     }

25     fprintf(ansysfile,"ASBL,1,ALL\n");

26     fprintf(ansysfile,"AGLUE,All\n");

27

28     //创建单元类型

29     fprintf(ansysfile,"ET,1,PLANE42\n");

30     //创建材料

31     fprintf(ansysfile,"MP,DENS,1,0.1\n");//材料一

32     fprintf(ansysfile,"MP,DENS,2,10\n");//材料二

33     //为基体赋一号材料值

34     fprintf(ansysfile,"ASEL,S,AREA,,ARINQR(0,14)\n");

35     fprintf(ansysfile,"AATT,1\n");

36

37     //为颗粒赋二号材料值

38     fprintf(ansysfile,"ASEL,ALL\n");

39     fprintf(ansysfile,"ASEL,U,AREA,,ARINQR(0,14)\n");

40     fprintf(ansysfile,"AATT,2\n");

41     fprintf(ansysfile,"ALLSEL,ALL\n");

42

43     //生成网格

44     //网格尺寸

45     fprintf(ansysfile,"SMRT,3\n");

46     //fprintf(ansysfile,"AESIZE,ALL,0.6,\n");

47

48     fprintf(ansysfile,"MSHAPE,1,2D\n");

49     fprintf(ansysfile,"MSHKEY,0\n");

50     //开始划分网格

51     fprintf(ansysfile,"AMESH,ALL\n");

52

53     //输出网格

54 //  fprintf(ansysfile,"/INPUT,ExportMesh,inp\n");

55

56     fclose(ansysfile);

57 //---------------调用ANSYS生成网格

58     system("D:\\Progra~1\\AnsysI~1\\v100\\ANSYS\\bin\\intel\\ansys100 -b -i temp.inp -o mesh.log");

59 //  system("tec360 tecplot.plt");

60 }

小菜鸡的主页 小菜鸡 | 初学一级 | 园豆:102
提问于:2013-05-13 14:12
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册