


GETBSTOKES - computes the B matrix for Stokes' diagnostic
Compute B matrix. B=[B1 B2 B3 B4 B5 B6 Bb] where Bi is of size numgrids*NDOF
For grid i, Bi can be expressed in the basic coordinate system by:
Bi_basic=[ dh/dx 0 0 0 ]
[ 0 dh/dy 0 0 ]
[ 0 0 dh/dy 0 ]
[ 1/2*dh/dy 1/2*dh/dx 0 0 ]
[ 1/2*dh/dz 0 1/2*dh/dx 0 ]
[ 0 1/2*dh/dz 1/2*dh/dy 0 ]
[ 0 0 0 h ]
[ dh/dx dh/dy dh/dz 0 ]
where h is the interpolation function for grid i.
Same thing for Bb except the last column that does not exist.
Usage:
B=GetBStokes(pentaelem,xyz_list,gauss_coord)
See also GETBPRIMESTOKES, CREATEKMATRIX

0001 function B=GetBStokes(pentaelem,xyz_list,gauss_coord) 0002 %GETBSTOKES - computes the B matrix for Stokes' diagnostic 0003 % 0004 % Compute B matrix. B=[B1 B2 B3 B4 B5 B6 Bb] where Bi is of size numgrids*NDOF 0005 % For grid i, Bi can be expressed in the basic coordinate system by: 0006 % Bi_basic=[ dh/dx 0 0 0 ] 0007 % [ 0 dh/dy 0 0 ] 0008 % [ 0 0 dh/dy 0 ] 0009 % [ 1/2*dh/dy 1/2*dh/dx 0 0 ] 0010 % [ 1/2*dh/dz 0 1/2*dh/dx 0 ] 0011 % [ 0 1/2*dh/dz 1/2*dh/dy 0 ] 0012 % [ 0 0 0 h ] 0013 % [ dh/dx dh/dy dh/dz 0 ] 0014 % where h is the interpolation function for grid i. 0015 % Same thing for Bb except the last column that does not exist. 0016 % 0017 % Usage: 0018 % B=GetBStokes(pentaelem,xyz_list,gauss_coord) 0019 % 0020 % See also GETBPRIMESTOKES, CREATEKMATRIX 0021 0022 num_grids=6; % the bubble in not included 0023 NDOF4=4; 0024 0025 l1l6=GetNodalFunctions(pentaelem, gauss_coord); 0026 dh1dh7_basic=GetNodalFunctionsDerivativesBasicStokes(pentaelem,xyz_list,gauss_coord); 0027 0028 %Build B: 0029 B=zeros(8,NDOF4*num_grids+3); 0030 for i=1:num_grids+1, 0031 B(1,NDOF4*(i-1)+1)=dh1dh7_basic(1,i); 0032 B(1,NDOF4*(i-1)+2)=0; 0033 B(1,NDOF4*(i-1)+3)=0; 0034 0035 B(2,NDOF4*(i-1)+1)=0; 0036 B(2,NDOF4*(i-1)+2)=dh1dh7_basic(2,i); 0037 B(2,NDOF4*(i-1)+3)=0; 0038 0039 B(3,NDOF4*(i-1)+1)=0; 0040 B(3,NDOF4*(i-1)+2)=0; 0041 B(3,NDOF4*(i-1)+3)=dh1dh7_basic(3,i); 0042 0043 B(4,NDOF4*(i-1)+1)=dh1dh7_basic(2,i)/2; 0044 B(4,NDOF4*(i-1)+2)=dh1dh7_basic(1,i)/2; 0045 B(4,NDOF4*(i-1)+3)=0; 0046 0047 B(5,NDOF4*(i-1)+1)=dh1dh7_basic(3,i)/2; 0048 B(5,NDOF4*(i-1)+2)=0; 0049 B(5,NDOF4*(i-1)+3)=dh1dh7_basic(1,i)/2; 0050 0051 B(6,NDOF4*(i-1)+1)=0; 0052 B(6,NDOF4*(i-1)+2)=dh1dh7_basic(3,i)/2; 0053 B(6,NDOF4*(i-1)+3)=dh1dh7_basic(2,i)/2; 0054 0055 B(7,NDOF4*(i-1)+1)=0; 0056 B(7,NDOF4*(i-1)+2)=0; 0057 B(7,NDOF4*(i-1)+3)=0; 0058 0059 B(8,NDOF4*(i-1)+1)=dh1dh7_basic(1,i); 0060 B(8,NDOF4*(i-1)+2)=dh1dh7_basic(2,i); 0061 B(8,NDOF4*(i-1)+3)=dh1dh7_basic(3,i); 0062 end 0063 0064 %Add the columns corresponding to pressure (not for the bubble) 0065 for i=1:num_grids, 0066 B(7,NDOF4*(i-1)+4)=l1l6(i); 0067 end