Home > Src > Level_2 > stiff_2d_sp.m

stiff_2d_sp

PURPOSE ^

STIFF_2D_SP Computes 2D local SEM matrix associated to (nabla(phi_j), nabla(phi_i))_N

SYNOPSIS ^

function [A]=stiff_2d_sp(wx,dx,jacx,wy,dy,jacy);

DESCRIPTION ^

 STIFF_2D_SP Computes 2D local SEM matrix associated to (nabla(phi_j), nabla(phi_i))_N

     (nabla(phi_j), nabla(phi_i))_N 


    [A]=stiff_2d_sp(wx,dx,jacx,wy,dy,jacy);
        produces the matrix
        A_{ij}=(nabla(phi_j), nabla(phi_i))_N 
        of size
        (mn,mn) where mn=npdx*npdy is the local number of d.o.f.

 Input : 
         wx = npdx LGL weigths in [-1,1],
            (produced by calling [x,wx]=xwlgl(npdx))
         dx =first derivative LGL matrix (by calling dx=derlgl(x,npdx))
         jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2
         wy = npdy LGL weigths in [-1,1],
            (produced by calling [y,wy]=xwlgl(npdy))
         dy =first derivative LGL matrix (by calling dy=derlgl(y,npdy))
         jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2
         ww = column array with local weigths, length: npdx*npdy

 Output: A = matrix (npdx*npdy,npdx*npdy)


 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 [A]=stiff_2d_sp(wx,dx,jacx,wy,dy,jacy);
0002 % STIFF_2D_SP Computes 2D local SEM matrix associated to (nabla(phi_j), nabla(phi_i))_N
0003 %
0004 %     (nabla(phi_j), nabla(phi_i))_N
0005 %
0006 %
0007 %    [A]=stiff_2d_sp(wx,dx,jacx,wy,dy,jacy);
0008 %        produces the matrix
0009 %        A_{ij}=(nabla(phi_j), nabla(phi_i))_N
0010 %        of size
0011 %        (mn,mn) where mn=npdx*npdy is the local number of d.o.f.
0012 %
0013 % Input :
0014 %         wx = npdx LGL weigths in [-1,1],
0015 %            (produced by calling [x,wx]=xwlgl(npdx))
0016 %         dx =first derivative LGL matrix (by calling dx=derlgl(x,npdx))
0017 %         jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2
0018 %         wy = npdy LGL weigths in [-1,1],
0019 %            (produced by calling [y,wy]=xwlgl(npdy))
0020 %         dy =first derivative LGL matrix (by calling dy=derlgl(y,npdy))
0021 %         jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2
0022 %         ww = column array with local weigths, length: npdx*npdy
0023 %
0024 % Output: A = matrix (npdx*npdy,npdx*npdy)
0025 %
0026 %
0027 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0028 %                    "Spectral Methods. Fundamentals in Single Domains"
0029 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0030 
0031 %   Written by Paola Gervasio
0032 %   $Date: 2007/04/01$
0033 
0034 npdx=length(wx);
0035 npdy=length(wy);
0036 jacyx=jacy/jacx;
0037 jacxy=jacx/jacy;
0038 mn=npdx*npdy;
0039 [wx1,wy1]=meshgrid(wx,wy); ww=wx1.*wy1; ww=ww'; ww=ww(:); clear wx1 wy1;
0040 
0041 A=sparse(mn,mn);A=0;
0042 B=sparse(mn,mn);B=0;
0043 for ki=1:npdy
0044     inde=((ki-1)*npdx+1:ki*npdx);
0045     A(inde,inde)=dx'*(diag(ww(inde))*dx)*jacyx;
0046 end
0047 
0048 for i=1:npdx
0049     inde=(i:npdx:mn);
0050     B(inde,inde)=dy'*(diag(ww(inde))*dy)*jacxy;
0051 end
0052 A=A+B;
0053

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