资源描述:
《弹性力学平面问题有限元程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、弹性力学平面问题有限元程序有限单元法有限单元法有限单元法有限单元法弹性力学平面问题有限元程序弹性力学平面问题有限元程序弹性力学平面问题有限元程序弹性力学平面问题有限元程序#defineNODE_NUM300#defineELE_NUM200#defineNODE2NODE_NUM*2#include#include#includeintnj,ne,nm,nz,npj,jm[ELE_NUM][4],nzc[60],nj2,bw,lxm;floatea,e,um,oul,te,xy
2、[NODE_NUM][4],EA[5],p[NODE2],pj,F[ELE_NUM],etm[5][5];floatek[7][7];double**K,*f;intBAND2(intn,intm,double**K,double*f);double**TwoArrayAlloc(int,int);voidTwoArrayFree(double**);FILE*outf;/*-------------------------------------------*/double**TwoArrayAlloc(intr,intc){d
3、ouble*x,**y;intn;x=(double*)calloc(r*c,sizeof(double));y=(double**)calloc(r,sizeof(double*));for(n=0;n<=r-1;++n)y[n]=&x[c*n];return(y);}/*-------------------------------------------*/voidTwoArrayFree(double**x){free(x[0]);free(x);}/*-----------------------------------
4、-------*/intBAND2(intn,intm,double**K,double*f){inti,j,t,ij,ji,it,jt,tm,m1;doubles,w;m1=m+1;for(i=1;i<=n;i++){if(K[i-1][m1-1]<=0)return(0);w=0.0;if(i>m1)tm=i-m;elsetm=1;for(j=tm;j<=i;j++){s=0.0;ij=j-i+m1;for(t=tm;t<=j-1;t++){it=t-i+m1;jt=t-j+m1;s=s+K[i-1][it-1]*K[j-1]
5、[jt-1]/K[t-1][m1-1];}K[i-1][ij-1]=K[i-1][ij-1]-s;if(j==i)f[i-1]=f[i-1]-w;elsew=w+K[i-1][ij-1]*f[j-1]/K[j-1][m1-1];}}for(i=n;i>=1;i--){s=0.0;if(i>n-m1)tm=n;elsetm=i+m;for(j=i+1;j<=tm;j++){ji=i-j+m1;s=s+K[j-1][ji-1]*f[j-1];}f[i-1]=(f[i-1]-s)/K[i-1][m1-1];}return1;}/*---
6、--------------------------------------*/voidinput(){intjj,j,i,nh,nl;floatdx,dy;FILE*infile;charname1[30],name2[30];R:printf("pleaseenterdata-filename");scanf("%s",name1);if((infile=fopen(name1,"r"))==NULL){printf("thedata-filenotexit!");gotoR;}printf("Pleaseenterres
7、ult-filename");scanf("%s",name2);outf=fopen(name2,"w");fscanf(infile,"%d%d%d%d%d%d5d",&nj,&ne,&nm,&nz,&npj,&lxm);for(i=1;i<=nj;i++){for(j=1;j<3;j++)fscanf(infile,"%f",&xy[i][j]);}for(i=1;i<=ne;i++){for(j=0;j<4;j++)fscanf(infile,"%d",&jm[i][j]);}for(i=1;i<=nm;i++){fo
8、r(j=1;j<=4;j++)fscanf(infile,"%f",&etm[i][j]);}for(i=1;i<=nz;i++)fscanf(infile,"%d",&nzc[i]);nj2=nj*2;for(i=0;i