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