ADR_1D_SE Assembles 1D global spectral element matrix associated to adr operator -(nu u' + b(x) u)'+gam u advection-diffusion-raction operator -(nu u' + b(x) u)'+gam u [A]=adr_1d_se(npdx,ne,nov,nu,b,gam,wx,dx,jacx); produces the matrix A_{ij}=(nu (phi_j)' + b phi_j, (phi_i)') +(gam phi_j,phi_i) of size (noe,noe) where noe=nov(npdx,ne) is the number of d.o.f. Input : npdx = polynomial degree in every element ne = number of spectral elements nov = local -global map, previously generated by cosnov1d 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) 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 (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]=adr_1d_se(npdx,ne,nov,nu,b,gam,wx,dx,jacx); 0002 % ADR_1D_SE Assembles 1D global spectral element matrix associated to adr operator -(nu u' + b(x) u)'+gam u 0003 % 0004 % advection-diffusion-raction operator -(nu u' + b(x) u)'+gam u 0005 % 0006 % 0007 % [A]=adr_1d_se(npdx,ne,nov,nu,b,gam,wx,dx,jacx); produces the matrix 0008 % 0009 % A_{ij}=(nu (phi_j)' + b phi_j, (phi_i)') +(gam phi_j,phi_i) of size 0010 % 0011 % (noe,noe) where noe=nov(npdx,ne) is the number of d.o.f. 0012 % 0013 % Input : npdx = polynomial degree in every element 0014 % ne = number of spectral elements 0015 % nov = local -global map, previously generated by cosnov1d 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 % wx = npdx LGL weigths in [-1,1], 0021 % (produced by calling [x,w]=xwlgl(npdx)) 0022 % (npdx = number of nodes, =n+1, if n=polynomial degree) 0023 % dx = first derivative LGL matrix (produced by calling d=derlgl(x,npdx)) 0024 % jacx = jacobian of the map F:[-1,1]---->[xa_ie,b_ie] 0025 % 0026 % Output: A = matrix (noe,noe) 0027 % 0028 % 0029 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0030 % "Spectral Methods. Fundamentals in Single Domains" 0031 % Springer Verlag, Berlin Heidelberg New York, 2006. 0032 0033 % Written by Paola Gervasio 0034 % $Date: 2007/04/01$ 0035 0036 noe=nov(npdx,ne); 0037 A=sparse(noe,noe); 0038 for ie=1:ne 0039 Al=adr_1d_sp(wx,dx,jacx(ie),nu,b(nov(1:npdx,ie)),gam); 0040 A(nov(1:npdx,ie),nov(1:npdx,ie))=A(nov(1:npdx,ie),nov(1:npdx,ie))+Al; 0041 end 0042 0043