Mathematica/Matlab Function
-
Upload
kamineni-jagath -
Category
Documents
-
view
212 -
download
0
Transcript of Mathematica/Matlab Function
-
8/19/2019 Mathematica/Matlab Function
1/5
function [matmtrx]=fematiso(iopt,elastic,poisson)
%------------------------------------------------------------------------
% Purpose:
% determine the constitutive equation for isotropic material
%
% Snopsis:
% [matmtrx]=fematiso(iopt,elastic,poisson)%
% !aria"le #escription:
% elastic - elastic modulus
% poisson - Poisson$s ratio
% iopt= - plane stress analsis
% iopt=& - plane strain analsis
% iopt=' - axismmetric analsis
% iopt= - three dimensional analsis
%------------------------------------------------------------------------
if iopt== % plane stress
matmtrx= elastic(-poisson*poisson)* +++
[ poisson +++
poisson +++
(-poisson)&]
elseif iopt==& % plane strain
matmtrx= elastic((.poisson)*(-&*poisson))* +++
[(-poisson) poisson
poisson (-poisson)
(-&*poisson)&]
elseif iopt==' % axismmetr
matmtrx= elastic((.poisson)*(-&*poisson))* +++
[(-poisson) poisson poisson
poisson (-poisson) poisson
poisson poisson (-poisson)
(-&*poisson)&]
else % three-dimension
matmtrx= elastic((.poisson)*(-&*poisson))* +++
[(-poisson) poisson poisson
poisson (-poisson) poisson
poisson poisson (-poisson)
(-&*poisson)&
(-&*poisson)&
(-&*poisson)&]
end
function [point&,/ei0ht&]=fe0lqd&(n0lx,n0l)
%-------------------------------------------------------------------
% Purpose:
% determine the inte0ration points and /ei0htin0 coefficients
% of 1auss-2e0endre quadrature for t/o-dimensional inte0ration
%
% Snopsis:
-
8/19/2019 Mathematica/Matlab Function
2/5
% [point&,/ei0ht&]=fe0lqd&(n0lx,n0l)
%
% !aria"le #escription:
% n0lx - num"er of inte0ration points in the x-axis
% n0l - num"er of inte0ration points in the -axis
% point& - vector containin0 inte0ration points
% /ei0ht& - vector containin0 /ei0htin0 coefficients
%-------------------------------------------------------------------
% determine the lar0est one "et/een n0lx and n0l
if n0lx 3 n0l
n0l=n0lx
else
n0l=n0l
end
% initiali4ation
point&=4eros(n0l,&)
/ei0ht&=4eros(n0l,&)
% find correspondin0 inte0ration points and /ei0hts
[pointx,/ei0htx]=fe0lqd(n0lx) % quadrature rule for x-axis
[point,/ei0ht]=fe0lqd(n0l) % quadrature rule for -axis
% quadrature for t/o-dimension
for intx=:n0lx % quadrature in x-axis
point&(intx,)=pointx(intx)
/ei0ht&(intx,)=/ei0htx(intx)
end
for int=:n0l % quadrature in -axis
point&(int,&)=point(int)
/ei0ht&(int,&)=/ei0ht(int)end
3
function [5aco"&]=fe5aco"&(nnel,dhdr,dhds,xcoord,coord)
%------------------------------------------------------------------------
% Purpose:
% determine the 6aco"ian for t/o-dimensional mappin0
%
% Snopsis:
% [5aco"&]=fe5aco"&(nnel,dhdr,dhds,xcoord,coord)
%
% !aria"le #escription:
% 5aco"& - 6aco"ian for one-dimension% nnel - num"er of nodes per element
% dhdr - derivative of shape functions /+r+t+ natural coordinate r
% dhds - derivative of shape functions /+r+t+ natural coordinate s
% xcoord - x axis coordinate values of nodes
% coord - axis coordinate values of nodes
%------------------------------------------------------------------------
5aco"&=4eros(&,&)
-
8/19/2019 Mathematica/Matlab Function
3/5
for i=:nnel
5aco"&(,)=5aco"&(,).dhdr(i)*xcoord(i)
5aco"&(,&)=5aco"&(,&).dhdr(i)*coord(i)
5aco"&(&,)=5aco"&(&,).dhds(i)*xcoord(i)
5aco"&(&,&)=5aco"&(&,&).dhds(i)*coord(i)
end
function [dhdx,dhd]=federiv&(nnel,dhdr,dhds,inv5aco")
%------------------------------------------------------------------------
% Purpose:
% determine derivatives of &-# isoparametric shape functions /ith
% respect to phsical coordinate sstem
%
% Snopsis:
% [dhdx,dhd]=federiv&(nnel,dhdr,dhds,inv5aco")
%
% !aria"le #escription:
% dhdx - derivative of shape function /+r+t+ phsical coordinate x
% dhd - derivative of shape function /+r+t+ phsical coordinate
% nnel - num"er of nodes per element
% dhdr - derivative of shape functions /+r+t+ natural coordinate r
% dhds - derivative of shape functions /+r+t+ natural coordinate s% inv5aco" - inverse of &-# 6aco"ian matrix
%------------------------------------------------------------------------
for i=:nnel
dhdx(i)=inv5aco"(,)*dhdr(i).inv5aco"(,&)*dhds(i)
dhd(i)=inv5aco"(&,)*dhdr(i).inv5aco"(&,&)*dhds(i)
end
5
function [7inmtp"]=fe7inep"(nnel,dhdx,dhd)
%--------------------------------------------------------------------------
% Purpose:% determine the 7inematic matrix expression relatin0 "endin0 curvatures
% to rotations and displacements for shear deforma"le plate "endin0
%
% Snopsis:
% [7inmtp"]=fe7inep"(nnel,dhdx,dhd)
%
% !aria"le #escription:
% nnel - num"er of nodes per element
% dhdx - derivatives of shape functions /ith respect to x
% dhd - derivatives of shape functions /ith respect to
%--------------------------------------------------------------------------
for i=:nnel
i=(i-)*'.i&=i.
i'=i&.
7inmtp"(,i)=dhdx(i)
7inmtp"(&,i&)=dhd(i)
7inmtp"(',i)=dhd(i)
7inmtp"(',i&)=dhdx(i)
7inmtp"(',i')=
end
-
8/19/2019 Mathematica/Matlab Function
4/5
-
8/19/2019 Mathematica/Matlab Function
5/5
888
function [shapeq,dhdrq,dhdsq]=feisoq(rvalue,svalue)
%------------------------------------------------------------------------
% Purpose:
% compute isoparametric four-node quadilateral shape functions
% and their derivatves at the selected (inte0ration) point
% in terms of the natural coordinate
%
% Snopsis:
% [shapeq,dhdrq,dhdsq]=feisoq(rvalue,svalue)
%
% !aria"le #escription:
% shapeq - shape functions for four-node element
% dhdrq - derivatives of the shape functions /+r+t+ r
% dhdsq - derivatives of the shape functions /+r+t+ s
% rvalue - r coordinate value of the selected point
% svalue - s coordinate value of the selected point
%
% 9otes:
% st node at (-,-), &nd node at (,-)% 'rd node at (,), th node at (-,)
%------------------------------------------------------------------------
% shape functions
shapeq()=+&*(-rvalue)*(-svalue)
shapeq(&)=+&*(.rvalue)*(-svalue)
shapeq(')=+&*(.rvalue)*(.svalue)
shapeq()=+&*(-rvalue)*(.svalue)
% derivatives
dhdrq()=-+&*(-svalue)
dhdrq(&)=+&*(-svalue)
dhdrq(')=+&*(.svalue)
dhdrq()=-+&*(.svalue)
dhdsq()=-+&*(-rvalue)
dhdsq(&)=-+&*(.rvalue)
dhdsq(')=+&*(.rvalue)
dhdsq()=+&*(-rvalue)