View
156
Download
4
Category
Preview:
DESCRIPTION
clc clear all close all %% geometry Lx=0.1; %m Ly=0.1; %m L=sqrt(Lx^2+Ly^2); A=0.001; %m2 alpha=pi/4; E=210e9; Ex=[0 Lx]; Ey=[0 Ly]; % Bouandary and load condition pres=[4]; fix=[1 2 3]; % Time stepping acc. to Newton Raphson nstep=100; tol=1e-6; maxiter=100; % Max number iterations ndof=4; % initial values x=zeros(ndof,1); % history variables x_hist=zeros(ndof,nstep); f_hist=zeros(ndof,nstep); u=zeros(4,1); for i=1:nstep+1 x=[0 0 0.1 -Ly+2*Ly*(i-1)/nstep]; du=2*Ly/nstep; alpha=atan(-x(4)/x
Citation preview
clc
clear all
close all
%% geometry
Lx=0.1; %m
Ly=0.1; %m
L=sqrt(Lx^2+Ly^2);
A=0.001; %m2
alpha=pi/4;
E=210e9;
Ex=[0 Lx];
Ey=[0 Ly];
% Bouandary and load condition
pres=[4];
fix=[1 2 3];
% Time stepping acc. to Newton Raphson
nstep=100;
tol=1e-6;
maxiter=100; % Max number iterations
ndof=4;
% initial values
x=zeros(ndof,1);
% history variables
x_hist=zeros(ndof,nstep);
f_hist=zeros(ndof,nstep);
u=zeros(4,1);
for i=1:nstep+1
x=[0 0 0.1 -Ly+2*Ly*(i-1)/nstep];
du=2*Ly/nstep;
alpha=atan(-x(4)/x(3));
K=(A*E/L)*[1 -1;-1 1];
R=[cos(alpha) sin(alpha) 0 0;
0 0 cos(alpha) sin(alpha)];
K_glob=R’*K*R;
f=K_glob*x’;
1
x_hist(:,i)=x’;
f_hist(:,i)=f;
end
plot(x_hist(4,:)/L,f_hist(4,:)/(E*A))
grid on
-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8-0.25
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
2
Continuum mechanics modelclc
clear all
close all
%% Material parameters
global E
E=210e9;
alfa=pi/4;
b=0.2; % the base
%% ------------------ Part a
A1=0.001;
A2=A1;
A=[A1 A2];
nen=2;
% Positions
x=[-b/2 0 b/2];
h=b/(2*tan(alfa));
y=[0 h 0];
z=[0 0 0];
Coord=[x’ y’ z’];
Dof=[1 2 3;4 5 6;7 8 9];
Edof=[1 1 2 3 4 5 6; 2 4 5 6 7 8 9];
[ex,ey,ez]=coordxtr(Edof,Coord,Dof,nen);
nelem=2;
figure(3)
plotpar=[1 3 1];
eldraw2(ex,ey,plotpar)
% Bouandary and load condition
free=[4];
pres=[1 2 3 5 6 7 8 9];
% Time stepping acc. to Newton Raphson
nstep=50;
tol=1e-6;
3
maxiter=100; % Max number iterations
ndof=max(max(Edof));
% initial values
x=zeros(ndof,1);
x(free)=[0];
% history variables
x_hist=zeros(ndof,nstep);
T_hist=zeros(ndof,nstep);
tau_hist=zeros(nelem,nstep);
eps_hist=zeros(nelem,nstep);
for i=1:nstep
x(pres)=[-b/2 0 0 h-2*h*(i-1)/nstep 0 b/2 0 0];
for k=1:maxiter
K=zeros(ndof);
T=zeros(ndof,1);
for j=1:nelem
Xa=[ex(j,1) ey(j,1) ez(j,1)];
Xb=[ex(j,2) ey(j,2) ez(j,2)];
Xe=[Xa Xb]’;
xa=x(Edof(j,2:4))’;
xb=x(Edof(j,5:7))’;
xe=[xa xb]’;
[Te,Ke,tau(j),eps(j)]=bar_element(Xa,Xb,xa,xb,A(j));
[K,T]=assem(Edof(j,:),K,Ke,T,Te);
end
g=T(free);
if norm(g)<tol
disp([’Timestep ’ num2str(i) ’, convergence at ’ num2str(k)
’ iterations. Residual: ’ num2str(norm(g))])
break
elseif k==maxiter
error([’Divergence at ’ num2str(maxiter) ’ iterations’])
end
4
x(free)=x(free)-inv(K(free,free))*T(free);
end
Ex=[x(1) x(4);x(4) x(7)];
Ey=[x(2) x(5);x(5) x(8)];
Ez=[x(3) x(6);x(6) x(9)];
figure(4)
plotpar=[1 3 1];
eldraw2(Ex,Ey,plotpar); hold all;
function [Te,Ke,tau,eps]=bar_element(Xa,Xb,xa,xb,A)
global E
L=norm(Xb-Xa);
l=norm(xb-xa);
n=(xb-xa)/norm(xb-xa);
lambda=l/L;
eps=log(lambda);
tau=E*eps;
tau_prim=E;
Tb=tau*exp(-eps)*A*n;
Ta=-Tb;
Te=[Ta’; Tb’];
dTbdxb=(tau_prim-2*tau)*exp(-2*eps)*A/L*n’*n+tau*exp(-2*eps)*A/L*eye(3);
dTadxa=dTbdxb;
dTbdxa=-dTbdxb;
dTadxb=-dTbdxb;
Ke=[dTadxa dTadxb;
dTbdxa dTbdxb];
end
5
-0.8-0.6-0.4-0.200.20.40.60.8-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
force-displacement in symetrical case
uy/L
Fy/A
E
-0.1 -0.05 0 0.05 0.1
-0.08
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1
6
Recommended