0001 function shape = element_shape_function(type,x,y,z)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
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