STIFF_1D_SP Computes local stiffness matrix for 1D problem [A]=stiff_1d_sp(w,d,jac) computes stiffness matrix A: A_{ij} = ( (phi_j)',(phi_i)')_N by Galerkin-Numerical Integration Input: w = npdx LGL weigths in [-1,1], (produced by calling [x,w]=xwlgl(npdx)) (npdx = number of nodes, =n+1, if n=polynomial degree) d = first derivative LGL matrix (produced by calling d=derlgl(x,npdx)) jac = jacobian of the map F:[-1,1]---->[a,b] Output: A = matrix (npdx,npdx) with the stiffness contribution 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_1d_sp(w,d,jac) 0002 % STIFF_1D_SP Computes local stiffness matrix for 1D problem 0003 % 0004 % [A]=stiff_1d_sp(w,d,jac) computes stiffness matrix A: 0005 % A_{ij} = ( (phi_j)',(phi_i)')_N 0006 % by Galerkin-Numerical Integration 0007 % 0008 % Input: 0009 % w = npdx LGL weigths in [-1,1], 0010 % (produced by calling [x,w]=xwlgl(npdx)) 0011 % (npdx = number of nodes, =n+1, if n=polynomial degree) 0012 % d = first derivative LGL matrix (produced by calling d=derlgl(x,npdx)) 0013 % jac = jacobian of the map F:[-1,1]---->[a,b] 0014 % 0015 % Output: A = matrix (npdx,npdx) with the stiffness contribution 0016 % 0017 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0018 % "Spectral Methods. Fundamentals in Single Domains" 0019 % Springer Verlag, Berlin Heidelberg New York, 2006. 0020 0021 % Written by Paola Gervasio 0022 % $Date: 2007/04/01$ 0023 0024 A=d'*diag(w)*d; 0025 A=A/jac; 0026 return