ADR_1D_SP Computes 1D local spectral matrix associated to adr operator -(nu u' + b(x) u)'+gam u advection-diffusion-raction operator (one spectral element) [A]=adr_1d_sp(wx,dx,jacx,nu,b,gam) produces the matrix Input: A_{ij}=(nu phi_j' + b phi_j, phi'_i)_N +(gam phi_j,phi_i)_N 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] nu = viscosity (constant>0) b = column vector with evaluation of b(x) at LGL node of the spectral element gam = coefficient of zeroth order term (constant>0) 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]=adr_1d_sp(wx,dx,jacx,nu,b,gam) 0002 % ADR_1D_SP Computes 1D local spectral matrix associated to adr operator -(nu u' + b(x) u)'+gam u 0003 % 0004 % advection-diffusion-raction operator (one spectral element) 0005 % 0006 % [A]=adr_1d_sp(wx,dx,jacx,nu,b,gam) produces the matrix 0007 % 0008 % Input: 0009 % A_{ij}=(nu phi_j' + b phi_j, phi'_i)_N +(gam phi_j,phi_i)_N 0010 % 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 % nu = viscosity (constant>0) 0017 % b = column vector with evaluation of b(x) at LGL node of the spectral 0018 % element 0019 % gam = coefficient of zeroth order term (constant>0) 0020 % 0021 % Output: A = matrix (npdx,npdx) defined above 0022 % 0023 % 0024 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0025 % "Spectral Methods. Fundamentals in Single Domains" 0026 % Springer Verlag, Berlin Heidelberg New York, 2006. 0027 0028 % Written by Paola Gervasio 0029 % $Date: 2007/04/01$ 0030 0031 coef1=nu/jacx; coef2=gam*jacx; 0032 A=dx'*(diag(wx)*(coef1*dx+diag(b)))+coef2*diag(wx); 0033