ELL_1D_SP Computes 1D local SEM matrix associated to -nu* u''+beta u' +gam u [A]=ell_1d_sp(nu,beta,gam,wx,dx,jacx) computes stiffness matrix A: A_{ij} =nu*(phi_j', phi'_i)_N+beta(phi_j',phi_i)_N Input: nu = viscosity (constant>0) beta = coefficient of first order term (constant) gam = coefficient of zero-order term (constant>=0) wx= npdx LGL weigths in [-1,1], (produced by calling [x,wx]=xwlgl(npdx)) (npdx = number of nodes, =n+1, if n=polynomial degree) dx= first derivative LGL matrix (produced by calling dx=derlgl(x,npdx)) jacx = jacobian of the map F:[-1,1]---->[a,b] Output: A = matrix (npdx,npdx) 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]=ell_1d_sp(nu,beta,gam,wx,dx,jacx) 0002 % ELL_1D_SP Computes 1D local SEM matrix associated to -nu* u''+beta u' +gam u 0003 % 0004 % [A]=ell_1d_sp(nu,beta,gam,wx,dx,jacx) computes stiffness matrix A: 0005 % A_{ij} =nu*(phi_j', phi'_i)_N+beta(phi_j',phi_i)_N 0006 % 0007 % Input: 0008 % nu = viscosity (constant>0) 0009 % beta = coefficient of first order term (constant) 0010 % gam = coefficient of zero-order term (constant>=0) 0011 % wx= npdx LGL weigths in [-1,1], 0012 % (produced by calling [x,wx]=xwlgl(npdx)) 0013 % (npdx = number of nodes, =n+1, if n=polynomial degree) 0014 % dx= first derivative LGL matrix (produced by calling dx=derlgl(x,npdx)) 0015 % jacx = jacobian of the map F:[-1,1]---->[a,b] 0016 % 0017 % Output: A = matrix (npdx,npdx) 0018 % 0019 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0020 % "Spectral Methods. Fundamentals in Single Domains" 0021 % Springer Verlag, Berlin Heidelberg New York, 2006. 0022 0023 % Written by Paola Gervasio 0024 % $Date: 2007/04/01$ 0025 0026 n=length(wx); 0027 coef1=nu/jacx; coef2=gam*jacx; 0028 A=(coef1*dx'+beta*speye(n))*spdiags(wx,0,n,n)*dx+coef2*spdiags(wx,0,n,n); 0029 0030 return