Mathematica/Matlab Function
Mathematica/Matlab Function
%-----------------------------------------------------------------------% Purpose:
%
determine the constitutive equation for isotropic material
%
% Synopsis:
%
[matmtrx]=fematiso(iopt,elastic,poisson)
%
% Variable Description:
%
elastic - elastic modulus
%
poisson - Poisson's ratio
%
iopt=1 - plane stress analysis
%
iopt=2 - plane strain analysis
%
iopt=3 - axisymmetric analysis
%
iopt=4 - three dimensional analysis
%-----------------------------------------------------------------------if iopt==1
% plane stress
matmtrx= elastic/(1-poisson*poisson)* ...
[1 poisson 0; ...
poisson 1 0; ...
0 0 (1-poisson)/2];
elseif iopt==2
% plane strain
matmtrx= elastic/((1+poisson)*(1-2*poisson))* ...
[(1-poisson) poisson 0;
poisson (1-poisson) 0;
0 0 (1-2*poisson)/2];
elseif iopt==3
% axisymmetry
matmtrx= elastic/((1+poisson)*(1-2*poisson))* ...
[(1-poisson) poisson poisson 0;
poisson (1-poisson)
poisson 0;
poisson poisson (1-poisson)
0;
0
0
0
(1-2*poisson)/2];
else
% three-dimension
matmtrx= elastic/((1+poisson)*(1-2*poisson))* ...
[(1-poisson) poisson poisson
0
0
0;
poisson (1-poisson)
poisson
0
0
0;
poisson poisson (1-poisson)
0
0
0;
0
0
0
(1-2*poisson)/2
0
0;
0
0
0
0
(1-2*poisson)/2
0;
0
0
0
0
0
(1-2*poisson)/2];
end
function [point2,weight2]=feglqd2(nglx,ngly)
%------------------------------------------------------------------% Purpose:
%
determine the integration points and weighting coefficients
%
of Gauss-Legendre quadrature for two-dimensional integration
%
% Synopsis:
%
[point2,weight2]=feglqd2(nglx,ngly)
%
% Variable Description:
%
nglx - number of integration points in the x-axis
%
ngly - number of integration points in the y-axis
%
point2 - vector containing integration points
%
weight2 - vector containing weighting coefficients
%------------------------------------------------------------------%
initialization
point2=zeros(ngl,2);
weight2=zeros(ngl,2);
% quadrature in x-axis
for inty=1:ngly
point2(inty,2)=pointy(inty);
weight2(inty,2)=weighty(inty);
end
% quadrature in y-axis
3
function [jacob2]=fejacob2(nnel,dhdr,dhds,xcoord,ycoord)
%-----------------------------------------------------------------------% Purpose:
%
determine the Jacobian for two-dimensional mapping
%
% Synopsis:
%
[jacob2]=fejacob2(nnel,dhdr,dhds,xcoord,ycoord)
%
% Variable Description:
%
jacob2 - Jacobian for one-dimension
%
nnel - number of nodes per element
%
dhdr - derivative of shape functions w.r.t. natural coordinate r
%
dhds - derivative of shape functions w.r.t. natural coordinate s
%
xcoord - x axis coordinate values of nodes
%
ycoord - y axis coordinate values of nodes
%-----------------------------------------------------------------------jacob2=zeros(2,2);
for i=1:nnel
jacob2(1,1)=jacob2(1,1)+dhdr(i)*xcoord(i);
jacob2(1,2)=jacob2(1,2)+dhdr(i)*ycoord(i);
jacob2(2,1)=jacob2(2,1)+dhds(i)*xcoord(i);
jacob2(2,2)=jacob2(2,2)+dhds(i)*ycoord(i);
end
4function [dhdx,dhdy]=federiv2(nnel,dhdr,dhds,invjacob)
%-----------------------------------------------------------------------% Purpose:
%
determine derivatives of 2-D isoparametric shape functions with
%
respect to physical coordinate system
%
% Synopsis:
%
[dhdx,dhdy]=federiv2(nnel,dhdr,dhds,invjacob)
%
% Variable Description:
%
dhdx - derivative of shape function w.r.t. physical coordinate x
%
dhdy - derivative of shape function w.r.t. physical coordinate y
%
nnel - number of nodes per element
%
dhdr - derivative of shape functions w.r.t. natural coordinate r
%
dhds - derivative of shape functions w.r.t. natural coordinate s
%
invjacob - inverse of 2-D Jacobian matrix
%-----------------------------------------------------------------------for i=1:nnel
dhdx(i)=invjacob(1,1)*dhdr(i)+invjacob(1,2)*dhds(i);
dhdy(i)=invjacob(2,1)*dhdr(i)+invjacob(2,2)*dhds(i);
end
function [kinmtpb]=fekinepb(nnel,dhdx,dhdy)
%-------------------------------------------------------------------------% Purpose:
%
determine the kinematic matrix expression relating bending curvatures
%
to rotations and displacements for shear deformable plate bending
%
% Synopsis:
%
[kinmtpb]=fekinepb(nnel,dhdx,dhdy)
%
% Variable Description:
%
nnel - number of nodes per element
%
dhdx - derivatives of shape functions with respect to x
%
dhdy - derivatives of shape functions with respect to y
%-------------------------------------------------------------------------for i=1:nnel
i1=(i-1)*3+1;
i2=i1+1;
i3=i2+1;
kinmtpb(1,i1)=dhdx(i);
kinmtpb(2,i2)=dhdy(i);
kinmtpb(3,i1)=dhdy(i);
kinmtpb(3,i2)=dhdx(i);
kinmtpb(3,i3)=0;
end
666
function [shapeq4,dhdrq4,dhdsq4]=feisoq4(rvalue,svalue)
%-----------------------------------------------------------------------% Purpose:
%
compute isoparametric four-node quadilateral shape functions
%
and their derivatves at the selected (integration) point
%
in terms of the natural coordinate
%
% Synopsis:
%
[shapeq4,dhdrq4,dhdsq4]=feisoq4(rvalue,svalue)
%
% Variable Description:
%
shapeq4 - shape functions for four-node element
%
dhdrq4 - derivatives of the shape functions w.r.t. r
%
dhdsq4 - derivatives of the shape functions w.r.t. s
%
rvalue - r coordinate value of the selected point
%
svalue - s coordinate value of the selected point
%
% Notes:
%
1st node at (-1,-1), 2nd node at (1,-1)
%
3rd node at (1,1), 4th node at (-1,1)
%-----------------------------------------------------------------------% shape functions
shapeq4(1)=0.25*(1-rvalue)*(1-svalue);
shapeq4(2)=0.25*(1+rvalue)*(1-svalue);
shapeq4(3)=0.25*(1+rvalue)*(1+svalue);
shapeq4(4)=0.25*(1-rvalue)*(1+svalue);
% derivatives
dhdrq4(1)=-0.25*(1-svalue);
dhdrq4(2)=0.25*(1-svalue);
dhdrq4(3)=0.25*(1+svalue);
dhdrq4(4)=-0.25*(1+svalue);
dhdsq4(1)=-0.25*(1-rvalue);
dhdsq4(2)=-0.25*(1+rvalue);
dhdsq4(3)=0.25*(1+rvalue);
dhdsq4(4)=0.25*(1-rvalue);