Home > Src > Elliptic_2d > Schwarz > cosnovenew.m

cosnovenew

PURPOSE ^

COSNOVENEW Construction of restriction maps for extended elements

SYNOPSIS ^

function [nove,nvle]=cosnovenew(nx,nex,ny,ney,nov,ifro,nlevel);

DESCRIPTION ^

  COSNOVENEW   Construction of restriction maps for extended elements 

      [nove,nvle]=cosnovenew(npdx,nex,npdy,ney,nov,ifro,nlevel);

 Input: nx = polynomial degree in each spectral element along x-direction
        nex = number of spectral elements along x-direction
        ny = polynomial degree in each spectral element along y-direction
        ney = number of spectral elements along y-direction
        nov = 2-index array of local to global map, 
               size(nov)=[max(npdx*npdy),ne]
        ifro = column array of length noe=nov(npdx*npdy,ne): 
            if (x_i,y_i) is internal to Omega then ifro(i)=0,
            if (x_i,y_i) is on \partial\Omega then ifro(i)=1,
        nlevel = number of added layers for extending spectral elements
                   inside additive Schwarz preconditioner.
                   If param(2)==1, the preconditioner is P^{m}_{as,H} 
                                    (minimum overlap), pag. 377 CHQZ3)
                   If param(2)==2, the preconditioner is P^{s}_{as,H} 
                                    (small overlap), pag. 377 CHQZ3)
                   param(2) is a positive integer less than min(nx,ny)

 Output: nove = 2-index array of "extended local" to global map, 
         nvle = 2-index array:
                 nvle (:,1)=number of nodes of the extendend elements
                 nvle (:,2)=number of Q1 elements of the extendend elements
                            along x-direction
                 nvle (:,3)=number of Q1 elements of the extendend elements
                            along y-direction


 References: CHQZ3 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
                    "Spectral Methods. Evolution to Complex Geometries 
                     and Applications to Fluid DynamicsSpectral Methods"
                    Springer Verlag, Berlin Heidelberg New York, 2007.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [nove,nvle]=cosnovenew(nx,nex,ny,ney,nov,ifro,nlevel);
0002 %  COSNOVENEW   Construction of restriction maps for extended elements
0003 %
0004 %      [nove,nvle]=cosnovenew(npdx,nex,npdy,ney,nov,ifro,nlevel);
0005 %
0006 % Input: nx = polynomial degree in each spectral element along x-direction
0007 %        nex = number of spectral elements along x-direction
0008 %        ny = polynomial degree in each spectral element along y-direction
0009 %        ney = number of spectral elements along y-direction
0010 %        nov = 2-index array of local to global map,
0011 %               size(nov)=[max(npdx*npdy),ne]
0012 %        ifro = column array of length noe=nov(npdx*npdy,ne):
0013 %            if (x_i,y_i) is internal to Omega then ifro(i)=0,
0014 %            if (x_i,y_i) is on \partial\Omega then ifro(i)=1,
0015 %        nlevel = number of added layers for extending spectral elements
0016 %                   inside additive Schwarz preconditioner.
0017 %                   If param(2)==1, the preconditioner is P^{m}_{as,H}
0018 %                                    (minimum overlap), pag. 377 CHQZ3)
0019 %                   If param(2)==2, the preconditioner is P^{s}_{as,H}
0020 %                                    (small overlap), pag. 377 CHQZ3)
0021 %                   param(2) is a positive integer less than min(nx,ny)
0022 %
0023 % Output: nove = 2-index array of "extended local" to global map,
0024 %         nvle = 2-index array:
0025 %                 nvle (:,1)=number of nodes of the extendend elements
0026 %                 nvle (:,2)=number of Q1 elements of the extendend elements
0027 %                            along x-direction
0028 %                 nvle (:,3)=number of Q1 elements of the extendend elements
0029 %                            along y-direction
0030 %
0031 %
0032 % References: CHQZ3 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0033 %                    "Spectral Methods. Evolution to Complex Geometries
0034 %                     and Applications to Fluid DynamicsSpectral Methods"
0035 %                    Springer Verlag, Berlin Heidelberg New York, 2007.
0036 
0037 %   Written by Paola Gervasio
0038 %   $Date: 2007/04/01$
0039 
0040 [ldnov,ne]=size(nov);
0041 
0042 npdx=nx+1; npdy=ny+1;mn=npdx*npdy;
0043 nm1=mn-nx;
0044 mne=(npdx+nlevel*2)*(npdy+nlevel*2);
0045 nove=zeros(mne,ne);
0046 nvle=zeros(ne,3);
0047 for ie=1:ne
0048 nove(1:mn,ie)=nov(1:mn,ie);
0049 nvle(ie,2)=nx; nvle(ie,3)=ny;
0050 ultimo=mn;
0051 vertex=zeros(4,1);
0052 
0053 % vertex 1
0054 
0055 ig=nov(1,ie);
0056 if(ifro(ig)<=0)
0057 vertex(1)=1;
0058 % The vertex is inside Omega, I expand nov
0059 % by adding the last  "nlevel" rows of the domain down
0060 for ib=1:nlevel
0061     nove(ultimo+1:ultimo+npdx,ie)=nov(npdx*(ny-ib)+1:npdx*(ny-ib+1),ie-1);
0062 ultimo=ultimo+npdx; nvle(ie,3)=nvle(ie,3)+1;
0063 end
0064 
0065 % by adding the last  "nlevel" columns of the left domain
0066 for ib=1:nlevel
0067 nove(ultimo+1:ultimo+npdy,ie)=nov(nx-ib+1:npdx:mn-ib,ie-ney);
0068 ultimo=ultimo+npdy; nvle(ie,2)=nvle(ie,2)+1;
0069 end
0070 % by adding nodes of the element symmetric to "ie" with respect to the vertex
0071 for ib=1:nlevel
0072     nove(ultimo+1:ultimo+nlevel,ie)=nov(mn-npdx*ib-nlevel:mn-npdx*ib-1,ie-ney-1);
0073 ultimo=ultimo+nlevel;
0074 end
0075 end
0076 
0077 % vertex 2
0078 
0079 ig=nov(npdx,ie);
0080 if(ifro(ig)<=0)
0081 vertex(2)=1;
0082 % The vertex is inside Omega, I expand nov
0083 if vertex(1)==0
0084 % by adding the last  "nlevel" rows of the  domain down
0085 for ib=1:nlevel
0086     nove(ultimo+1:ultimo+npdx,ie)=nov(npdx*(ny-ib)+1:npdx*(ny-ib+1),ie-1);
0087 ultimo=ultimo+npdx;nvle(ie,3)=nvle(ie,3)+1;
0088 end
0089 end
0090 % by adding the first  "nlevel" columns of the right domain
0091 for ib=1:nlevel
0092 nove(ultimo+1:ultimo+npdy,ie)=nov(ib+1:npdx:nm1+ib,ie+ney);
0093 ultimo=ultimo+npdy; nvle(ie,2)=nvle(ie,2)+1;
0094 end
0095 % by adding nodes of the element symmetric to "ie" with respect to the vertex
0096  for ib=1:nlevel
0097      nove(ultimo+1:ultimo+nlevel,ie)=nov(mn-npdx*(ib+1)+2:mn-npdx*(ib+1)+1+nlevel,ie+ney-1);
0098  ultimo=ultimo+nlevel;
0099 end
0100 end
0101 
0102 % vertex 3
0103 
0104 ig=nov(mn,ie);
0105 if(ifro(ig)<=0)
0106 vertex(3)=1;
0107 % The vertex is inside Omega, I expand nov
0108 if vertex(2)==0
0109 % by adding the first  "nlevel" columns of the right domain
0110 for ib=1:nlevel
0111     nove(ultimo+1:ultimo+npdy,ie)=nov(ib+1:npdx:nm1+ib,ie+ney);
0112 ultimo=ultimo+npdy; nvle(ie,2)=nvle(ie,2)+1;
0113 end
0114 end
0115 % by adding the last  "nlevel" rows of the  domain up
0116 for ib=1:nlevel
0117     nove(ultimo+1:ultimo+npdx,ie)=nov(npdx*ib+1:npdx*(ib+1),ie+1);
0118 ultimo=ultimo+npdx; nvle(ie,3)=nvle(ie,3)+1;
0119 end
0120 % by adding nodes of the element symmetric to "ie" with respect to the vertex
0121 for ib=1:nlevel
0122     nove(ultimo+1:ultimo+nlevel,ie)=nov(npdx*ib+2:npdx*ib+1+nlevel,ie+ney+1);
0123 ultimo=ultimo+nlevel;
0124 end
0125 end
0126 
0127 % vertex 4
0128 
0129 ig=nov(nm1,ie);
0130 if(ifro(ig)<=0)
0131 vertex(4)=1;
0132 % The vertex is inside Omega, I expand nov
0133 if vertex(1)==0
0134 % by adding the last  "nlevel" columns of the left domain
0135 for ib=1:nlevel
0136     nove(ultimo+1:ultimo+npdy,ie)=nov(nx-ib+1:npdx:mn-ib,ie-ney);
0137 ultimo=ultimo+npdy; nvle(ie,2)=nvle(ie,2)+1;
0138 end
0139 end
0140 if vertex(3)==0
0141 % by adding the last  "nlevel" rows of the  domain up
0142 for ib=1:nlevel
0143     nove(ultimo+1:ultimo+npdx,ie)=nov(npdx*ib+1:npdx*(ib+1),ie+1);
0144 ultimo=ultimo+npdx; nvle(ie,3)=nvle(ie,3)+1;
0145 end
0146 end
0147 % by adding nodes of the element symmetric to "ie" with respect to the vertex
0148 for ib=1:nlevel
0149     nove(ultimo+1:ultimo+nlevel,ie)=nov(npdx*(ib+1)-nlevel:npdx*(ib+1)-1,ie-ney+1);
0150 ultimo=ultimo+nlevel;
0151 end
0152 end
0153 nvle(ie,1)=ultimo;
0154 
0155 end  % end loop ie

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