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