Home > Src > Elliptic_1d > matricesp1_1d.m

matricesp1_1d

PURPOSE ^

MARICESP1_1D P1 - Local mass and stiffness matrices on [-1,1]

SYNOPSIS ^

function [Al,Ml,Mld]=matricesp1_1d(nu,beta,gam,jacx,param);

DESCRIPTION ^

 MARICESP1_1D     P1 - Local mass and stiffness matrices on [-1,1]

  [Al,Ml,Mld]=matricesp1_1d(jacx);

 Input: nu   = viscosity (constant>0)
        beta  = coefficient of first order term (constant)
        gam   = coefficient of zeroth order term (constant>=0)
        jacx = jacobian of the map F:[-1,1] --- > (x_1,x_2)

 Output: Al  =local P1 matrix
         Ml  = Local P1 mass matrix
         Mld = local P1 mass matrix with numerical integration (trapezoidal
        rule)

 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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Al,Ml,Mld]=matricesp1_1d(nu,beta,gam,jacx,param);
0002 % MARICESP1_1D     P1 - Local mass and stiffness matrices on [-1,1]
0003 %
0004 %  [Al,Ml,Mld]=matricesp1_1d(jacx);
0005 %
0006 % Input: nu   = viscosity (constant>0)
0007 %        beta  = coefficient of first order term (constant)
0008 %        gam   = coefficient of zeroth order term (constant>=0)
0009 %        jacx = jacobian of the map F:[-1,1] --- > (x_1,x_2)
0010 %
0011 % Output: Al  =local P1 matrix
0012 %         Ml  = Local P1 mass matrix
0013 %         Mld = local P1 mass matrix with numerical integration (trapezoidal
0014 %        rule)
0015 %
0016 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0017 %                    "Spectral Methods. Fundamentals in Single Domains"
0018 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0019 
0020 %   Written by Paola Gervasio
0021 %   $Date: 2007/04/01$
0022 
0023 
0024 % local P1 - mass matrix
0025 Ml=[2 1; 1 2];
0026 Ml=Ml/3*jacx;
0027 
0028 % local P1 - stiffness matrix
0029 Al=[1, -1; -1, 1];
0030 Al=Al/(2*jacx);
0031 
0032 % local P1 - first derivative matrix
0033 Al1=[-1, 1; -1, 1];
0034 Al1=Al1/2;
0035 
0036 % local P1  - mass matrix with numerical integration
0037 Mld=spdiags(ones(2,1),0,2,2)*jacx;
0038 
0039 if nu~=1
0040 Al=nu*Al;
0041 end
0042 if beta~=0
0043     Al=Al+beta*Al1;
0044 end
0045 if gam~=0
0046     if param(1)==1 | param(1)==4 | param(1)==5
0047     Al=Al+gam*Ml;
0048     elseif param(1)==2 | param(1)==3
0049     Al=Al+gam*Mld;
0050     end
0051 end

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003