FEMP1_PRECO_1D P1 (stiffness and mass) matrices for 2-nd order 1D b.v.p. The computational domain is split in ne spectral elements. In each element, P1 matrices are assembled -nu u''+ beta*u' + gam u =f xa < x < xb bounadry conditions are not imposed here [AFE,MFE,MFEd]=femp1_preco_1d(npdx,ne,nov,jacx,xy,nu,beta,gam,param); Input : npdx = number of nodes in each spectral element ne = number of spectral elements nov = local -global map, previously generated by cosnov1d jacx = array (length(jacx)=ne); jacx(ie)= jacobian of of the map F_ie:[-1,1]---->[xa_ie,xb_ie] xy = column array with global mesh, length: noe=nov(npdx,ne) nu = viscosity (constant>0) beta = coefficient of first order term (constant) gam = coefficient of zeroth order term (constant>=0) param = parameters array : param(1)= choice of the preconditioner: 0 : P=I A=K_GNI 1 : P=K_FE (4.4.45), pag. 221, CHQZ2 A=K_GNI 2 : P=M_FE^{-1}K_FE (4.4.46), pag. 221, CHQZ2 A=M_GNI^{-1}K_GNI 3 : P=M_FE,d^{-1}K_FE (4.4.47), pag. 221, CHQZ2 A=M_GNI^{-1}K_GNI 4 : P=M_FE^{-1/2}K_FE M_FE^{-1/2} (4.4.48), pag. 221, CHQZ2 A=M_GNI^{-1/2}K_GNI M_GNI^{-1/2} 5 : P=KM_FE<d^{-1/2}K_FE M_FE,d^{-1/2}_FE (4.4.49), pag. 221, CHQZ2 A=M_GNI^{-1/2}K_GNI M_GNI^{-1/2} Output: AFE = FEM Stiffness matrix K_FE (Tab. 4.6, pag. 221, CHQZ2) MFE = FEM Mass matrix (Tab. 4.6, pag. 221, CHQZ2) MFE = FEM Mass matrix with numerical integration (Tab. 4.6, pag. 221, CHQZ2) 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 [AFE,MFE,MFEd]=femp1_preco_1d(npdx,ne,nov,jacx,xy,nu,beta,gam,param); 0002 % FEMP1_PRECO_1D P1 (stiffness and mass) matrices for 2-nd order 1D b.v.p. 0003 % 0004 % The computational domain is split in ne 0005 % spectral elements. In each element, P1 matrices are assembled 0006 % 0007 % -nu u''+ beta*u' + gam u =f xa < x < xb 0008 % 0009 % bounadry conditions are not imposed here 0010 % 0011 % [AFE,MFE,MFEd]=femp1_preco_1d(npdx,ne,nov,jacx,xy,nu,beta,gam,param); 0012 % 0013 % Input : npdx = number of nodes in each spectral element 0014 % ne = number of spectral elements 0015 % nov = local -global map, previously generated by cosnov1d 0016 % jacx = array (length(jacx)=ne); jacx(ie)= jacobian of 0017 % of the map F_ie:[-1,1]---->[xa_ie,xb_ie] 0018 % xy = column array with global mesh, length: noe=nov(npdx,ne) 0019 % nu = viscosity (constant>0) 0020 % beta = coefficient of first order term (constant) 0021 % gam = coefficient of zeroth order term (constant>=0) 0022 % param = parameters array : 0023 % param(1)= choice of the preconditioner: 0024 % 0 : P=I 0025 % A=K_GNI 0026 % 1 : P=K_FE (4.4.45), pag. 221, CHQZ2 0027 % A=K_GNI 0028 % 2 : P=M_FE^{-1}K_FE (4.4.46), pag. 221, CHQZ2 0029 % A=M_GNI^{-1}K_GNI 0030 % 3 : P=M_FE,d^{-1}K_FE (4.4.47), pag. 221, CHQZ2 0031 % A=M_GNI^{-1}K_GNI 0032 % 4 : P=M_FE^{-1/2}K_FE M_FE^{-1/2} (4.4.48), pag. 221, CHQZ2 0033 % A=M_GNI^{-1/2}K_GNI M_GNI^{-1/2} 0034 % 5 : P=KM_FE<d^{-1/2}K_FE M_FE,d^{-1/2}_FE (4.4.49), pag. 221, CHQZ2 0035 % A=M_GNI^{-1/2}K_GNI M_GNI^{-1/2} 0036 % 0037 % Output: AFE = FEM Stiffness matrix K_FE (Tab. 4.6, pag. 221, CHQZ2) 0038 % MFE = FEM Mass matrix (Tab. 4.6, pag. 221, CHQZ2) 0039 % MFE = FEM Mass matrix with numerical integration 0040 % (Tab. 4.6, pag. 221, CHQZ2) 0041 % 0042 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang, 0043 % "Spectral Methods. Fundamentals in Single Domains" 0044 % Springer Verlag, Berlin Heidelberg New York, 2006. 0045 0046 % Written by Paola Gervasio 0047 % $Date: 2007/04/01$ 0048 0049 0050 0051 noe=nov(npdx,ne); 0052 AFE=sparse(noe,noe); 0053 MFE=sparse(noe,noe); 0054 MFEd=sparse(noe,noe); 0055 0056 for ie=1:ne 0057 noe_loc=npdx; 0058 xy_loc(1:noe_loc)=xy(nov(1:noe_loc,ie)); 0059 ne_loc=npdx-1; 0060 [AFE,MFE,MFEd]=precofem_1d_se(AFE,MFE,MFEd,ne_loc,xy_loc,... 0061 nov(1:npdx,ie),nu,beta,gam,param); 0062 end 0063 return