Home > Src > Level_2 > cosnov_2d.m

cosnov_2d

PURPOSE ^

COSNOV_2D : Constructs the 2D (local mesh ---> global mesh) map

SYNOPSIS ^

function [nov]=cosnov_2d(npdx,nex,npdy,ney);

DESCRIPTION ^

 COSNOV_2D : Constructs the 2D (local mesh ---> global mesh) map

 [nov]=cosnov_2d(npdx,nex,npdy,ney) computes the 2-index array nov:
       nov(i,ie) = is the index, with respect to global ordering,
                   associated to node i of element ie.

       __________________________
       |      |      |     |     |
       |  3   |  6   |  9  | 12  |      Omega and spectral elements 
       |      |      |     |     |      ordering
       __________________________
       |      |      |     |     |
       |  2   |  5   |  8  | 11  |    
       |      |      |     |     |
       __________________________
       |      |      |     |     |
       |  1   |  4   |  7  | 10  |
       |      |      |     |     |
       __________________________


 Input: npdx = number of nodes along x-direction inside 
               one element (the same in every element)
        nex  = number of elements along x-direction
        npdy = number of nodes along y-direction inside
               one element (the same in every element)
        ney  = number of elements along y-direction

 Output: nov = 2-index array of local to global map, 
               size(nov)=[max(npdx*npdy),ne]


 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 [nov]=cosnov_2d(npdx,nex,npdy,ney);
0002 % COSNOV_2D : Constructs the 2D (local mesh ---> global mesh) map
0003 %
0004 % [nov]=cosnov_2d(npdx,nex,npdy,ney) computes the 2-index array nov:
0005 %       nov(i,ie) = is the index, with respect to global ordering,
0006 %                   associated to node i of element ie.
0007 %
0008 %       __________________________
0009 %       |      |      |     |     |
0010 %       |  3   |  6   |  9  | 12  |      Omega and spectral elements
0011 %       |      |      |     |     |      ordering
0012 %       __________________________
0013 %       |      |      |     |     |
0014 %       |  2   |  5   |  8  | 11  |
0015 %       |      |      |     |     |
0016 %       __________________________
0017 %       |      |      |     |     |
0018 %       |  1   |  4   |  7  | 10  |
0019 %       |      |      |     |     |
0020 %       __________________________
0021 %
0022 %
0023 % Input: npdx = number of nodes along x-direction inside
0024 %               one element (the same in every element)
0025 %        nex  = number of elements along x-direction
0026 %        npdy = number of nodes along y-direction inside
0027 %               one element (the same in every element)
0028 %        ney  = number of elements along y-direction
0029 %
0030 % Output: nov = 2-index array of local to global map,
0031 %               size(nov)=[max(npdx*npdy),ne]
0032 %
0033 %
0034 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0035 %                    "Spectral Methods. Fundamentals in Single Domains"
0036 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0037 
0038 %   Written by Paola Gervasio
0039 %   $Date: 2007/04/01$
0040 
0041 ldnov=npdx*npdy;
0042 ne=nex*ney;
0043 nov=zeros(ldnov,ne);
0044 
0045 % element 1
0046 
0047 nov(:,1)=(1:ldnov)';
0048 
0049 % elements first column
0050 
0051 k=ldnov-npdx;
0052 for ie=2:ney
0053 nov(:,ie)=(k+1:k+ldnov)';
0054 k=k+ldnov-npdx;
0055 end
0056 kmax=k+npdx;
0057 
0058 % other columns
0059 
0060 nxm1=npdx-1;
0061 for iex=2:nex
0062 
0063 %  other rows, bottom elements
0064 
0065 ie=(iex-1)*ney+1;
0066 for j=1:npdy
0067 k=(j-1)*npdx;
0068 nov(k+1,ie)=nov(j*npdx,ie-ney);
0069 nov(k+2:k+npdx,ie)=(kmax+1:kmax+nxm1)';
0070 kmax=kmax+nxm1;
0071 end
0072 
0073 % other elements
0074 
0075 for iey=2:ney
0076 ie=(iex-1)*ney+iey;
0077 
0078 % first row
0079 nov(1:npdx,ie)=nov(ldnov-npdx+1:ldnov,ie-1);
0080 for j=2:npdy
0081 k=(j-1)*npdx;
0082 nov(k+1,ie)=nov(j*npdx,ie-ney);
0083 nov(k+2:k+npdx,ie)=(kmax+1:kmax+nxm1)';
0084 kmax=kmax+nxm1;
0085 end
0086 
0087 end
0088 end

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