element_d_shape_function

PURPOSE ^

DELEMSHAPEFUNC

SYNOPSIS ^

function dshape = element_d_shape_function(type,x,y,z)

DESCRIPTION ^

DELEMSHAPEFUNC  
Derivative of shape functions of elements in local coordiantes. The basis 
functions are for an anti-clockwise vertex arrangement triangle (or in 3D
anti-clockwise to the point of looking INTO triangle from a vertex)
DSHAPE = dshapefunc(TYPE,X,Y,Z)

INPUT:
1. X, Y, Z - local coordinates
2. TYPE - string describing different element typeswhat kind of element
   'tri3'  - Linear, 3 node triangle 
   'tri6'  - Quadratic, 6 node triangle
   'tri10' - Cubic, 10 node triangle
   'tet4'  - Linear, 4 node tetrahedral
   'tet10' - Quadratic, 10 node tetrahedral

OUTPUT
1. DELEMSHAPEFUNC - matrix of shape function derivatives size(ndim,nshape)
              - using convention : dshape(i,j) = d shape_{j} / d x_{i}

M Crabb - 29.06.2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function dshape = element_d_shape_function(type,x,y,z)
0002 %DELEMSHAPEFUNC
0003 %Derivative of shape functions of elements in local coordiantes. The basis
0004 %functions are for an anti-clockwise vertex arrangement triangle (or in 3D
0005 %anti-clockwise to the point of looking INTO triangle from a vertex)
0006 %DSHAPE = dshapefunc(TYPE,X,Y,Z)
0007 %
0008 %INPUT:
0009 %1. X, Y, Z - local coordinates
0010 %2. TYPE - string describing different element typeswhat kind of element
0011 %   'tri3'  - Linear, 3 node triangle
0012 %   'tri6'  - Quadratic, 6 node triangle
0013 %   'tri10' - Cubic, 10 node triangle
0014 %   'tet4'  - Linear, 4 node tetrahedral
0015 %   'tet10' - Quadratic, 10 node tetrahedral
0016 %
0017 %OUTPUT
0018 %1. DELEMSHAPEFUNC - matrix of shape function derivatives size(ndim,nshape)
0019 %              - using convention : dshape(i,j) = d shape_{j} / d x_{i}
0020 %
0021 %M Crabb - 29.06.2012
0022 
0023 if(strcmp(type,'tri3'))
0024     dshape = delemshapetri3(x,y,z);
0025 elseif(strcmp(type,'tri6'))
0026     dshape = delemshapetri6(x,y,z);
0027 elseif(strcmp(type,'tri10'))
0028     dshape = delemshapetri10(x,y,z);
0029 elseif(strcmp(type,'tet4'))
0030     dshape = delemshapetet4(x,y,z);
0031 elseif(strcmp(type,'tet10'))
0032     dshape = delemshapetet10(x,y,z);
0033 else
0034     error('Incorrect number of input arguments')
0035 end
0036 
0037 %TRIANGLE - USING [0,1]*[0,1] UNIT REFERENCE TRIANGLE
0038 
0039 function dshape = delemshapetri3(x,y,z)
0040 dshape(1,1) = -1; dshape(1,2) = 1; dshape(1,3) = 0;
0041 dshape(2,1) = -1; dshape(2,2) = 0; dshape(2,3) = 1;
0042 end
0043 
0044 function dshape = delemshapetri6(x,y,z)
0045 dshape(1,1) = -3 + 4*x + 4*y; dshape(2,1) = -3 + 4*x + 4*y;
0046 dshape(1,2) = 4*x - 1;        dshape(2,2) = 0;
0047 dshape(1,3) = 0;              dshape(2,3) = 4*y-1;
0048 dshape(1,4) = 4 - 8*x - 4*y;  dshape(2,4) = -4*x;
0049 dshape(1,5) = 4*y;            dshape(2,5) = 4*x; 
0050 dshape(1,6) = -4*y;           dshape(2,6) = 4 - 4*x - 8*y;
0051 end
0052 
0053 function dshape=delemshapetri10(x,y,z)
0054 dshape(1,1) = 0.5*(36*x+36*y-27*x*x-27*y*y-54*x*y-11); dshape(2,1) = 0.5*(36*x+36*y-27*x*x-27*y*y-54*x*y-11);
0055 dshape(1,2) = 13.5*x*x-9*x+1;                          dshape(2,2) = 0;
0056 dshape(1,3) = 0;                                       dshape(2,3) = 13.5*y*y-9*y+1;
0057 dshape(1,4) = 4.5*(2-10*x+9*x*x+12*x*y-5*y+3*y*y);     dshape(2,4) = 4.5*(6*x*x-5*x+6*x*y);
0058 dshape(1,5) = 4.5*(y-6*x*y-9*x*x+8*x-1);               dshape(2,5) = 4.5*x*(1-3*x);
0059 dshape(1,6) = 27*x*y-4.5*y;                            dshape(2,6) = 4.5*x*(3*x-1);
0060 dshape(1,7) = 4.5*y*(3*y-1);                           dshape(2,7) = 27*x*y-4.5*x;
0061 dshape(1,8) = 4.5*y*(1-3*y);                           dshape(2,8) = 4.5*(x-6*x*y-9*y*y+8*y-1);
0062 dshape(1,9) = 4.5*(6*x*y-5*y+6*y*y);                   dshape(2,9) = 4.5*(2-5*x+3*x*x+12*x*y-10*y+9*y*y);
0063 dshape(1,10) = 27*y-54*x*y-27*y*y;                     dshape(2,10) = 27*x-54*x*y-27*x*x;
0064 end
0065 
0066 
0067 
0068 
0069 
0070 
0071 %TETRAHEDRON - USING [0,1]*[0,1]*[0,1] UNIT REFERENCE TETRAHEDRON
0072 
0073 function dshape = delemshapetet4(x,y,z)
0074 dshape(1,1) = -1; dshape(2,1) = -1; dshape(3,1) = -1;
0075 dshape(1,2) = 1;  dshape(2,2) = 0;  dshape(3,2) = 0;
0076 dshape(1,3) = 0;  dshape(2,3) = 1;  dshape(3,3) = 0;
0077 dshape(1,4) = 0;  dshape(2,4) = 0;  dshape(3,4) = 1;
0078 end
0079 
0080 function dshape = delemshapetet10(x,y,z)
0081 dshape(1,1) = -3 + 4*x + 4*y + 4*z; dshape(2,1) = -3 + 4*x + 4*y + 4*z; dshape(3,1) = -3 + 4*x + 4*y + 4*z;
0082 dshape(1,2) = 4*x - 1;              dshape(2,2) = 0;                    dshape(3,2) = 0; 
0083 dshape(1,3) = 0;                    dshape(2,3) = 4*y-1;                dshape(3,3) = 0;
0084 dshape(1,4) = 0;                    dshape(2,4) = 0;                    dshape(3,4) = 4*z - 1;
0085 dshape(1,5) = 4 - 8*x - 4*y - 4*z;  dshape(2,5) = -4*x;                 dshape(3,5) = -4*x;
0086 dshape(1,6) = -4*y;                 dshape(2,6) = 4 - 4*x - 8*y - 4*z;  dshape(3,6) = -4*y;
0087 dshape(1,7)= -4*z;                  dshape(2,7)= -4*z;                  dshape(3,7) = 4 - 4*x - 4*y - 8*z;
0088 dshape(1,8) = 4*y;                  dshape(2,8) = 4*x;                  dshape(3,8) = 0;
0089 dshape(1,9) = 0;                    dshape(2,9) = 4*z;                  dshape(3,9) = 4*y;
0090 dshape(1,10) = 4*z;                 dshape(2,10) = 0;                   dshape(3,10) = 4*x;
0091 end
0092 
0093 end

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005