第六章 有限元三角形单元程序设计

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

nd(1)=nodes(iel,1); nd(2)=nodes(iel,2); nd(3)=nodes(iel,3);
%1st connected node for (iel)-th element %2nd connected node for (iel)-th element %3rd connected node for (iel)-th element
~ Kd f
~ 1 dK f
16:51
三角形单元程序
EU=0.5*disp'*kk1*disp; e U %--------------------------------------% element stress computation %--------------------------------------energy=0; for ielp=1:nel % loop for the total number of elements nd(1)=nodes(ielp,1); % 1st connected node for (iel)-th element nd(2)=nodes(ielp,2); % 2nd connected node for (iel)-th element nd(3)=nodes(ielp,3); % 3rd connected node for (iel)-th element x1=x0(nd(1),1); y1=x0(nd(1),2);% coord values of 1st node x2=x0(nd(2),1); y2=x0(nd(2),2);% coord values of 2nd node x3=x0(nd(3),1); y3=x0(nd(3),2);% coord values of 3rd node xcentre=(x1+x2+x3)/3; ycentre=(y1+y2+y3)/3; index=feeldof(nd,nnel,ndof);% extract system dofs associated with element
A(0, 0) D(4, 0)
C (4, 1)
B(0, 2)
16:51
三角形单元程序
%------------------------------------------------%initialization of matrices and vectors %------------------------------------------------ff=sparse(sdof,1); %system force vector k=sparse(edof,edof); %initialization of element matrix kk=sparse(sdof,sdof); %system matrix disp=sparse(sdof,1); %system displacement vector eldisp=sparse(edof,1); %element displacement vector stress=zeros(nel,3); %matrix containing stress components strain=zeros(nel,3); %matrix containing strain components index=sparse(edof,1); %index vector kinmtx=sparse(3,edof); %kinematic matrix matmtx=sparse(3,3); %constitutive matrix %------------------------------------------------%compute material matrices %------------------------------------------------matmtx=fematiso(1,emodule,poisson); %constitutive matrice 16:51
-0.5*lengthy*(1+(lx+1-i)/lx)*(1-(j-1)/ly)];
三角形单元程序
%---------------------------------------------------------------------%input data for nodal connectivity for each element %nodes(i,j) where i->element no. and j->connected nodes %---------------------------------------------------------------------nodes=[]; for i=1:lx for j=1:ly nodes=[nodes; (ly+1)*(i-1)+j (ly+1)*i+j (ly+1)*(i-1)+j+1;]; nodes=[nodes; (ly+1)*i+j (ly+1)*i+j+1 (ly+1)*(i-1)+j+1;]; end end
16:51
三角形单元程序
%---------------------------------%input data for boundary conditions %---------------------------------bcdof=[]; bcval=[]; for i=1:ly+1 bcdof=[bcdof 1+2*(i-1) 2+2*(i-1)]; bcval=[bcval 0 0]; end
A(0, 0) D(4, 0)
F 1
C (4, 1)
B(0, 2)
16:51
三角形单元程序
clear all first_time=cputime; format long %-------------------------------------------%input data for control parameters %-------------------------------------------lengthx=4; %length of x-axis side of problem lengthy=2; %length of y-axis side of problem emodule=1.0; poisson=0.0; %elastic modulus %Poisson's ratio
Ni, y
kinmtx2=fekine2d(nnel,dhdx,dhdy); k=kinmtx2'*matmtx*kinmtx2*area;
K e BT DBhdxdy BT DBA
A
kk=feasmb_2(kk,k,index); end
%assemble element matrics
%coord values of 1st node %coord values of 2nd node %coord values of 3rd node %extract system dofs for the element
x1=x0(nd(1),1); y1=x0(nd(1),2); x2=x0(nd(2),1); y2=x0(nd(2),2); x3=x0(nd(3),1); y3=x0(nd(3),2); index=feeldof(nd,nnel,ndof);
三角形单元程序
%------------------------------------------------%compute element matrices and vectors and assemble %------------------------------------------------for iel=1:nel %loop for the total number of element
1 T e de K de 2
16:51
Ni,x
area=0.5*(x1*y2+x2*y3+x3*y1-x1*y3-x2*y1-x3*y2); %area of triangula area2=area*2; dhdx=(1/area2)*[(y2-y3) (y3-y1) (y1-y2)]; dhdy=(1/area2)*[(x3-x2) (x1-x3) (x2-x1)]; %derivatives w.r.t x %derivatives w.r.t y %kinematic matrice %element stiffness matrice
16:51
三角形单元程序
kk1=kk; %-------------------------------------------------------------------------% force vector %-------------------------------------------------------------------------ff(sdof,1)=fload; %-----------------------% apply boundary condition %-----------------------[kk,ff]=feaplyc2(kk,ff,bcdof,bcval); %------------------------% solve the matrix equation %------------------------%disp=kk\ff; [LL UU]=lu(kk); utemp=LL\ff; disp=UU\utemp;
A(0, 0) D(4, 0)
F 1
fload=-1;
% the total load
B(0, 2)
Βιβλιοθήκη Baidu
C (4, 1)
16:51
三角形单元程序
lx=16; % number of element in x-axis ly=8; % number of element in y-axis nel=2*lx*ly; % number of element nnel=3; %number of nodes per element ndof=2; %number of dofs per node nnode=(lx+1)*(ly+1); %total number of nodes in system sdof=nnode*ndof; %total system dofs edof=nnel*ndof; %degrees of freedom per element %------------------------------------------------------%input data for nodal coordinate values %------------------------------------------------------x0=[]; for i=1:lx+1 for j=1:ly+1 x0=[x0; (i-1)*lengthx/lx end end 16:51
16:51
三角形单元程序
%--------------------------------------%find the derivatives of shape functions %---------------------------------------
1 Ni ai bi x ci y 2A
三角形单元程序设计
问题描述
考虑一个平面应力问题如图所示,假设厚度h=1,材料为各项 同性,杨氏模量为 E=1,泊松比为 ν=0,相关力和位移边界条 件如图中所示,问题左端为固定约束。试用两个三角形单元 分析此问题,三角形单元的网格划分如图所示。试求问题各 节点位移u、v和应力σx,σy和σxy。
相关文档
最新文档