element_shape_function

PURPOSE ^

ELEMENT_SHAPE_FUNCTION - Evaluation of shape functions

SYNOPSIS ^

function shape = element_shape_function(type,x,y,z)

DESCRIPTION ^

ELEMENT_SHAPE_FUNCTION  - Evaluation of shape functions
values each point


INPUT:
1. X, Y, Z - local coordinates
2. TYPE - string describing different element types
   'tri3' - Linear, 2 node 1D shape function 
   'tri 6'- Quadratic, 3 node 1D shape function
   'tet4' - Linear, 3 node triangle shape function
   'tet10' - Quadratic, 6 node triangle shape function

OUTPUT
1. MAPFUNC - vector of shape functions on this element

M Crabb - 29.06.2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function shape = element_shape_function(type,x,y,z)
0002 %ELEMENT_SHAPE_FUNCTION  - Evaluation of shape functions
0003 %values each point
0004 %
0005 %
0006 %INPUT:
0007 %1. X, Y, Z - local coordinates
0008 %2. TYPE - string describing different element types
0009 %   'tri3' - Linear, 2 node 1D shape function
0010 %   'tri 6'- Quadratic, 3 node 1D shape function
0011 %   'tet4' - Linear, 3 node triangle shape function
0012 %   'tet10' - Quadratic, 6 node triangle shape function
0013 %
0014 %OUTPUT
0015 %1. MAPFUNC - vector of shape functions on this element
0016 %
0017 %M Crabb - 29.06.2012
0018 
0019 if(strcmp(type,'tri3'))
0020     shape = elemshapetri3(x,y);
0021 elseif(strcmp(type,'tri6'))
0022     shape = elemshapetri6(x,y);
0023 elseif(strcmp(type,'tri10'))
0024     shape = elemshapetri10(x,y);
0025 elseif(strcmp(type,'tet4'))
0026     shape = elemshapetet4(x,y,z);
0027 elseif(strcmp(type,'tet10'))
0028     shape = elemshapetet10(x,y,z);
0029 else
0030     error('Incorrect number of input arguments')
0031 end
0032 
0033 
0034 function map = elemshapetri3(x,y)
0035 map(1) = 1-x-y;
0036 map(2) = x;
0037 map(3) = y;
0038 end
0039 
0040 function map = elemshapetri6(x,y)
0041 map(1) = (1-x-y)*(1-2*x-2*y);
0042 map(2) = x*(2*x-1);
0043 map(3) = y*(2*y-1);
0044 map(4) = 4*x*(1-x-y);
0045 map(5) = 4*x*y;
0046 map(6) = 4*y*(1-x-y);
0047 end
0048 
0049 function map = elemshapetri10(x,y)
0050 map(1) = 0.5*(1-x-y)*(1-3*x-3*y)*(2-3*x-3*y);
0051 map(2) = 0.5*x*(3*x-2)*(3*x-1);
0052 map(3) = 0.5*y*(3*y-2)*(3*y-1);
0053 map(4) = 4.5*x*(1-x-y)*(2-3*x-3*y);
0054 map(5) = 4.5*x*(1-x-y)*(3*x-1);
0055 map(6) = 4.5*x*y*(3*x-1);
0056 map(7) = 4.5*x*y*(3*y-1);
0057 map(8) = 4.5*y*(1-x-y)*(3*y-1);
0058 map(9) = 4.5*y*(1-x-y)*(2-3*x-3*y);
0059 map(10) = 27*x*y*(1-x-y);
0060 end
0061 
0062 
0063 function map = elemshapetet4(x,y,z)
0064 map(1) = (1-x-y-z);
0065 map(2) = x;
0066 map(3) = y;
0067 map(4) = z;
0068 end
0069 
0070 function map = elemshapetet10(x,y,z)
0071 map(1) = (1-x-y-z)*(1-2*x-2*y-2*z);
0072 map(2) = x*(2*x-1);
0073 map(3) = y*(2*y-1);
0074 map(4) = z*(2*z-1);
0075 map(5) = 4*x*(1-x-y-z);
0076 map(6) = 4*y*(1-x-y-z);
0077 map(7) = 4*z*(1-x-y-z);
0078 map(8) = 4*x*y;
0079 map(9) = 4*y*z;
0080 map(10) = 4*x*z;
0081 end
0082 
0083 
0084 end

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