STIFF_3D_SE Assembles 3D global stiffness SEM matrix associated to (nabla(phi_j), nabla(phi_i)) (nabla(phi_j), nabla(phi_i))_N [A]=stiff_3d_se(npdx,nex,npdy,ney,npdz,nez,nov,wx,dx,jacx,wy,dy,jacy,wz,dz,jacz); produces the matrix A_{ij}=(nabla(phi_j), nabla(phi_i))_N of size (noe,noe) where noe=nov(npdx*npdy*npdz,ne) is the number of d.o.f. Input : npdx = polynomial degree in every element along x-direction nex = number of elements (equally spaced) along x-direction npdy = polynomial degree in every element along y-direction ney = number of elements (equally spaced) along y-direction npdz = polynomial degree in every element along z-direction nez= number of elements (equally spaced) along z-direction nov = local -global map, previously generated by mesh_3d wx = npdx LGL weigths in [-1,1], (produced by calling [x,wx]=xwlgl(npdx)) dx =first derivative LGL matrix (produced by calling dx=derlgl(x,npdx)) jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2 wy = npdy LGL weigths in [-1,1], (produced by calling [y,wy]=xwlgl(npdy)) dy =first derivative LGL matrix (produced by calling dy=derlgl(y,npdy)) jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2 wz = npdy LGL weigths in [-1,1], (produced by calling [z,wz]=xwlgl(npdz)) dz =first derivative LGL matrix (produced by calling dz=derlgl(z,npdz) jacz = array (length(jacy)=ne); jacz(ie)= (y_V5_ie-y_V1_ie)/2 Output: A = matrix (noe,noe) Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, "Spectral Methods. Fundamentals in Single Domains" Springer Verlag, Berlin Heidelberg New York, 2006.
0001 function [A]=stiff_3d_se(npdx,nex,npdy,ney,npdz,nez,nov,wx,dx,jacx,wy,dy,jacy,wz,dz,jacz); 0002 % STIFF_3D_SE Assembles 3D global stiffness SEM matrix associated to (nabla(phi_j), nabla(phi_i)) 0003 % 0004 % (nabla(phi_j), nabla(phi_i))_N 0005 % 0006 % 0007 % [A]=stiff_3d_se(npdx,nex,npdy,ney,npdz,nez,nov,wx,dx,jacx,wy,dy,jacy,wz,dz,jacz); 0008 % produces the matrix 0009 % A_{ij}=(nabla(phi_j), nabla(phi_i))_N 0010 % of size 0011 % (noe,noe) where noe=nov(npdx*npdy*npdz,ne) is the number of d.o.f. 0012 % 0013 % Input : npdx = polynomial degree in every element along x-direction 0014 % nex = number of elements (equally spaced) along x-direction 0015 % npdy = polynomial degree in every element along y-direction 0016 % ney = number of elements (equally spaced) along y-direction 0017 % npdz = polynomial degree in every element along z-direction 0018 % nez= number of elements (equally spaced) along z-direction 0019 % nov = local -global map, previously generated by mesh_3d 0020 % wx = npdx LGL weigths in [-1,1], 0021 % (produced by calling [x,wx]=xwlgl(npdx)) 0022 % dx =first derivative LGL matrix (produced by calling dx=derlgl(x,npdx)) 0023 % jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2 0024 % wy = npdy LGL weigths in [-1,1], 0025 % (produced by calling [y,wy]=xwlgl(npdy)) 0026 % dy =first derivative LGL matrix (produced by calling dy=derlgl(y,npdy)) 0027 % jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2 0028 % wz = npdy LGL weigths in [-1,1], 0029 % (produced by calling [z,wz]=xwlgl(npdz)) 0030 % dz =first derivative LGL matrix (produced by calling dz=derlgl(z,npdz) 0031 % jacz = array (length(jacy)=ne); jacz(ie)= (y_V5_ie-y_V1_ie)/2 0032 % 0033 % 0034 % Output: A = matrix (noe,noe) 0035 % 0036 % 0037 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0038 % "Spectral Methods. Fundamentals in Single Domains" 0039 % Springer Verlag, Berlin Heidelberg New York, 2006. 0040 0041 % Written by Paola Gervasio 0042 % $Date: 2007/04/01$ 0043 0044 [ldnov,ne]=size(nov); 0045 noe=nov(ldnov,ne); 0046 A=sparse(noe,noe); 0047 for ie=1:ne 0048 Al=stiff_3d_sp(wx,dx,jacx(ie),wy,dy,jacy(ie),wz,dz,jacz(ie)); 0049 A(nov(1:ldnov,ie),nov(1:ldnov,ie))=A(nov(1:ldnov,ie),nov(1:ldnov,ie))+Al; 0050 end 0051