⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex10102.m

📁 The Finite Element Method Using MATLAB
💻 M
📖 第 1 页 / 共 2 页
字号:
%----------------------------------------------------------------------------
% Example 10.10.2                                                              
%   A cylinder is pinched across its diagonal direction with a force of 
%   100 lb at center lengthwise. It has the radius of 5 in., length of
%   10.35 in., and thickness of 0.094 in. 
%   The material has elastic modulus of 10.5 msi and Poisson's ratio 0.3125.
%   A one-eigths of the cylinder is modeled due to symmetry using          
%   25 four-node shell elements. 
%   (see Fig. 10.10.2 for the finite element mesh)
%
% Variable descriptions                                                      
%   k = element matrix in terms of local axes
%   kt = element matrix in terms of global axes
%   f = element vector
%   kk = system matrix                                             
%   ff = system vector                                                 
%   disp = system nodal displacement vector
%   gcoord = coordinate values of each node
%   nodes = nodal connectivity of each element
%   index = a vector containing system dofs associated with each element     
%   point1 = matrix containing sampling points for inplne axes
%   weight1 = matrix containing weighting coefficients for inplane axes
%   pointz = matrix containing sampling points for transverse axis
%   weightz = matrix containing weighting coefficients for transverse axis
%   bcdof = a vector containing dofs associated with boundary conditions     
%   bcval = a vector containing boundary condition values associated with    
%           the dofs in 'bcdof'                                              
%   bmtx = matrix for kinematic equation 
%   dmtx = matrix for material property 
%   trsh = nodal variable transformation matrix
%   rot6 = strain transformation matrix
%   aj = 3-D Jacobian matrix
%
%----------------------------------------------------------------------------            

%------------------------------------
%  input data for control parameters
%------------------------------------

clear
nel=25;                   % number of elements
nnel=4;                  % number of nodes per element
ndof=6;                  % number of dofs per node
nnode=36;                 % total number of nodes in system
sdof=nnode*ndof;         % total system dofs  
edof=nnel*ndof;          % degrees of freedom per element
emodule=10.5e6;            % elastic modulus
poisson=0.3125;             % Poisson's ratio
thick=0.094;                   % shell thickness
nglx=1; ngly=1; nglz=2;  % 1x1x2 Gauss-Legendre quadrature  
ngl=nglx*ngly*nglz;   % number of sampling points per element 

%---------------------------------------------
%  input data for nodal coordinate values
%  gcoord(i,j) where i->node no. and j->x,y,z
%---------------------------------------------

gcoord=[
    0.0000    0.0000    5.0000
    0.0000    1.0350    5.0000
    0.0000    2.0700    5.0000
    0.0000    3.1050    5.0000
    0.0000    4.1400    5.0000
    0.0000    5.1750    5.0000
    1.5451    0.0000    4.7553
    1.5451    1.0350    4.7553
    1.5451    2.0700    4.7553
    1.5451    3.1050    4.7553
    1.5451    4.1400    4.7553
    1.5451    5.1750    4.7553
    2.9389    0.0000    4.0451
    2.9389    1.0350    4.0451
    2.9389    2.0700    4.0451
    2.9389    3.1050    4.0451
    2.9389    4.1400    4.0451
    2.9389    5.1750    4.0451
    4.0451    0.0000    2.9389
    4.0451    1.0350    2.9389
    4.0451    2.0700    2.9389
    4.0451    3.1050    2.9389
    4.0451    4.1400    2.9389
    4.0451    5.1750    2.9389
    4.7553    0.0000    1.5451
    4.7553    1.0350    1.5451
    4.7553    2.0700    1.5451
    4.7553    3.1050    1.5451
    4.7553    4.1400    1.5451
    4.7553    5.1750    1.5451
    5.0000    0.0000    0.0000
    5.0000    1.0350    0.0000
    5.0000    2.0700    0.0000
    5.0000    3.1050    0.0000
    5.0000    4.1400    0.0000
    5.0000    5.1750    0.0000
];
     
%---------------------------------------------------------
%  input data for nodal connectivity for each element
%  nodes(i,j) where i-> element no. and j-> connected nodes
%---------------------------------------------------------

nodes=[
 7    8    2    1  ;
 8    9    3    2  ;
 9   10    4    3  ;
10   11    5    4  ;
11   12    6    5  ;
13   14    8    7  ;
14   15    9    8  ;
15   16   10    9  ;
16   17   11   10  ;
17   18   12   11  ;
19   20   14   13  ;
20   21   15   14  ;
21   22   16   15  ;
22   23   17   16  ;
23   24   18   17  ;
25   26   20   19  ;
26   27   21   20  ;
27   28   22   21  ;
28   29   23   22  ;
29   30   24   23  ;
31   32   26   25  ;
32   33   27   26  ;
33   34   28   27  ;
34   35   29   28  ;
35   36   30   29  ];

%-------------------------------------
%  input data for boundary conditions
%-------------------------------------

bcdof=[1               5   6  ...
       7              11  12  ...
      13              17  18  ...
      19              23  24  ... 
      25              29  30  ...
      31  32      34  35  36   ...
          38                   ...
          68      70      72   ...
         104     106     108  ...
         140     142     144  ...
         176     178     180  ...
             183 184 185      ...
             189 190 191      ...
             195 196 197      ...
             201 202 203      ...
             207 208 209      ...
         212 213 214 215 216 ];        % constrained dofs
bcval=zeros(size(bcdof));        % whose described values are 0 

%----------------------------------------------
%  initialization of matrices and vectors
%----------------------------------------------

ff=zeros(sdof,1);       % system force vector
kk=zeros(sdof,sdof);    % system matrix
disp=zeros(sdof,1);     % system displacement vector
index=zeros(edof,1);    % index vector
dmtx=zeros(6,6);      % constitutive matrix for shear

%----------------------------
%  force vector
%----------------------------

ff(33)=-25;              % transverse force at node 3

%-----------------------------------------------------------------
%  compute material property matrix
%-----------------------------------------------------------------

dmtx(1,1)=emodule/(1.0-poisson^2);
dmtx(1,2)=poisson*dmtx(1,1);
dmtx(2,1)=dmtx(1,2);
dmtx(2,2)=dmtx(1,1);
dmtx(4,4)=emodule/(2.0*(1.0+poisson));
dmtx(5,5)=(5/6)*dmtx(4,4);
dmtx(6,6)=dmtx(5,5);

%-----------------------------------------------------------------
%  computation of element matrices and vectors and their assembly
%-----------------------------------------------------------------
%
%  for inplane integration
%
[point1,weight1]=feglqd2(nglx,ngly);     % sampling points & weights
%
%  for transverse integration
%
[pointz,weightz]=feglqd1(nglz);     % sampling points & weights

for iel=1:nel           % loop for the total number of elements

for i=1:nnel
nd(i)=nodes(iel,i);         % extract connected node for (iel)-th element
xcoord(i)=gcoord(nd(i),1);  % extract x value of the node
ycoord(i)=gcoord(nd(i),2);  % extract y value of the node
zcoord(i)=gcoord(nd(i),3);  % extract z value of the node
end

k=zeros(edof,edof);         % initialization of element matrix
kt=zeros(edof,edof);        % initialization of transformed element matrix
trsh=zeros(edof,edof);      % initialization of coordinate transformation matrix

%------------------------------------------------------
%  compute direction cosine vectors
%  v1 and v2: tangent to the element
%  v3: normal to the element
%------------------------------------------------------

d1(1)=xcoord(2)-xcoord(1);		% define the vector from node 1 to node 2
d1(2)=ycoord(2)-ycoord(1);
d1(3)=zcoord(2)-zcoord(1);

d2(1)=xcoord(4)-xcoord(1);		% define the vector from node 4 to node 1
d2(2)=ycoord(4)-ycoord(1);
d2(3)=zcoord(4)-zcoord(1);

v3(1)=d1(2)*d2(3)-d1(3)*d2(2); % vector v3 normal to vectors d1 and d2
v3(2)=d1(3)*d2(1)-d1(1)*d2(3);
v3(3)=d1(1)*d2(2)-d1(2)*d2(1);
sum=sqrt(v3(1)^2+v3(2)^2+v3(3)^2); 
v3(1)=v3(1)/sum;	% make vector v3 a unit vector
v3(2)=v3(2)/sum;
v3(3)=v3(3)/sum;

if v3(2) > 0.999999	 % if v3 is along the y-axis, v1 is set along x-axis
v1(1)=1.0;
v1(2)=0.0;
v1(3)=0.0;
else					% otherwise, v1 is the cross product of y-axis and v3
v1(1)=v3(3);
v1(2)=0.0;
v1(3)=-v3(1);
sum=sqrt(v1(1)^2+v1(2)^2+v1(3)^2); 
v1(1)=v1(1)/sum;	% make vector v1 a unit vector
v1(2)=v1(2)/sum;
v1(3)=v1(3)/sum;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -