43 lines
1.4 KiB
Matlab
43 lines
1.4 KiB
Matlab
clear all;close all;clc
|
|
|
|
%---------------------GEOMETRY-----------------------
|
|
a=100; %('长度 in x: ');
|
|
b=100; %('宽度 in y: ');
|
|
%---------------------MESH---------------------------
|
|
ex=20; %input('x向单元个数: ');
|
|
ey=20; %input('y向单元个数: ');
|
|
mesh=MeshGenerator(a,b,ex,ey);
|
|
%---------------------ELEMENT------------------------
|
|
ShapeOption='Q4';%Q8 Q9
|
|
quadrature=GaussQuadrature('gauss2');% Q4 element points and weights
|
|
%---------------------MATERIAL------------------------
|
|
%SI mm t MPa N
|
|
material=struct();
|
|
material.t=1.6;
|
|
material.E=72000;
|
|
material.v=0.33;
|
|
material.rho=2.7e-9;
|
|
material.G=material.E/(2+2*material.v);
|
|
|
|
K=StiffnessMatrix(material,mesh,quadrature,ShapeOption);
|
|
M=MassMatrix(material,mesh,quadrature,ShapeOption);
|
|
%---------------------LOADS----------------------------
|
|
p0=1e-3;
|
|
F=ForceVector(mesh,quadrature,ShapeOption,p0);
|
|
% c0=input('\n集中荷载的大小: ');
|
|
% cl=input('\nLato da caricare: ');
|
|
% F=ForceVector(cl,c0,mesh);Lato da caricare
|
|
%---------------------CONSTRAINTS-----------------------
|
|
%nc is nodes of constrained elemment
|
|
nc=[mesh.lato1 mesh.lato2(2:end) mesh.lato3(2:end) mesh.lato4(2:end-1)];
|
|
[K_c,M_c,F_c,nctot]=Constraints(nc,K,M,F);
|
|
%---------------------SOLUTION---------------------------
|
|
w=StaticSolver(K_c,F_c,mesh,nctot);
|
|
%---------------------PLOT-------------------------------
|
|
figure
|
|
surf(mesh.x(1,:),mesh.y(:,1),reshape(w,size(mesh.x,2),size(mesh.x,1))');
|
|
% axis equal
|
|
hold on
|
|
title('Deformed geometry')
|
|
|