Home > Src > Level_2 > plot_sem_2d.m

plot_sem_2d

PURPOSE ^

PLOT_SEM_2D Plots SEM numerical solution of 2D boundary value problems

SYNOPSIS ^

function [ha]=plot_sem_2d(fig,command,nex,ney,x,xx,jacx,y,yy,jacy,xy,ww,nov,u,n_int);

DESCRIPTION ^

 PLOT_SEM_2D Plots SEM numerical solution of 2D boundary value problems

  [ha]=plot_sem_2d(fig,command,nex,ney,x,xx,jacx,y,yy,jacy,xy,ww,nov,...
    u,n_int);

 Input: fig =  figure number, set in the colling function by figure
                command
        command = either 'mesh', 'surf' or 'contour'
        nex = number of Spectral elements along x-direction
        ney = number of Spectral elements along y-direction
        x = LGL nodes in [-1,1] along x-direction
        xx = 2-indexes array of size (4,ne) 
            xx(1:4,ie)=[x_V1_ie;x_V2_ie;x_V3_ie;x_V4_ie]
            (ne=nex*ney is the global number of spectral elements)
        jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2
        y = LGL nodes in [-1,1] along y-direction
        yy = 2-indexes array of size (4,ne)
            yy(1:4,ie)=[y_V1_ie;y_V2_ie;y_V3_ie;y_V4_ie]
            (ne=nex*ney is the global number of spectral elements)
        jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2
        xy = column array with global mesh, length: noe=nov(npdx*npdy,ne)
        ww = column array with global weigths, length: noe=nov(npdx*npdy,ne)
             diag(ww) is the mass matrix associated to SEM discretization
        nov = local -global map, previously generated by cosnov_2d
        u = numerical solution
        n_int = number of nodes in each element to interpolate numerical
        solution by Level_0/legendre_tr_eval.m (Discrete Legendre Transform)

 Output: ha=gca of figure fig

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ha]=plot_sem_2d(fig,command,nex,ney,x,xx,jacx,y,yy,jacy,xy,ww,nov,...
0002     u,n_int);
0003 % PLOT_SEM_2D Plots SEM numerical solution of 2D boundary value problems
0004 %
0005 %  [ha]=plot_sem_2d(fig,command,nex,ney,x,xx,jacx,y,yy,jacy,xy,ww,nov,...
0006 %    u,n_int);
0007 %
0008 % Input: fig =  figure number, set in the colling function by figure
0009 %                command
0010 %        command = either 'mesh', 'surf' or 'contour'
0011 %        nex = number of Spectral elements along x-direction
0012 %        ney = number of Spectral elements along y-direction
0013 %        x = LGL nodes in [-1,1] along x-direction
0014 %        xx = 2-indexes array of size (4,ne)
0015 %            xx(1:4,ie)=[x_V1_ie;x_V2_ie;x_V3_ie;x_V4_ie]
0016 %            (ne=nex*ney is the global number of spectral elements)
0017 %        jacx = array (length(jacx)=ne); jacx(ie)= (x_V2_ie-x_V1_ie)/2
0018 %        y = LGL nodes in [-1,1] along y-direction
0019 %        yy = 2-indexes array of size (4,ne)
0020 %            yy(1:4,ie)=[y_V1_ie;y_V2_ie;y_V3_ie;y_V4_ie]
0021 %            (ne=nex*ney is the global number of spectral elements)
0022 %        jacy = array (length(jacy)=ne); jacy(ie)= (y_V3_ie-y_V1_ie)/2
0023 %        xy = column array with global mesh, length: noe=nov(npdx*npdy,ne)
0024 %        ww = column array with global weigths, length: noe=nov(npdx*npdy,ne)
0025 %             diag(ww) is the mass matrix associated to SEM discretization
0026 %        nov = local -global map, previously generated by cosnov_2d
0027 %        u = numerical solution
0028 %        n_int = number of nodes in each element to interpolate numerical
0029 %        solution by Level_0/legendre_tr_eval.m (Discrete Legendre Transform)
0030 %
0031 % Output: ha=gca of figure fig
0032 
0033 %   Written by Paola Gervasio
0034 %   $Date: 2007/04/01$
0035 
0036 %
0037 %
0038 %
0039 npdx=length(x);
0040 npdy=length(y);
0041 npdx1=n_int; npdy1=npdx1;
0042 hf=figure(fig);clf
0043 axis([min(xy(:,1)),max(xy(:,1)),min(xy(:,2)),max(xy(:,2))]);hold on
0044 ne=nex*ney;
0045 
0046 if nargin ==16
0047     % plot without interpolating
0048     cmin=min(u);cmax=max(u);
0049     caxis([cmin,cmax])
0050 
0051 for ie=1:ne
0052     mn=npdx*npdy;
0053     ctx=jacx(ie)*x+0.5*(xx(2,ie)+xx(1,ie));
0054     cty=jacy(ie)*y+0.5*(yy(3,ie)+yy(1,ie));
0055     clear uloc;
0056     uloc=reshape(u(nov(1:mn,ie)),npdx,npdy);
0057     if command(1,1)=='c'
0058         contour(ctx,cty,uloc',35);
0059     else
0060     eval([command,'(ctx,cty,uloc'')']); 
0061     end
0062     
0063 end    
0064 ha=gca;
0065 if command(1,1)~='c'
0066 set(ha,'view',[-36,34]);
0067 end
0068 else
0069     
0070 % plot with interpolation
0071 
0072     u_int=zeros(npdy1,npdx1,ne);
0073  
0074 for ie=1:ne
0075     mn=npdx*npdy;
0076     
0077 x1=xwlgl(npdx1); y1=xwlgl(npdy1);
0078 
0079 uloc=reshape(u(nov(1:mn,ie)),npdx,npdy);
0080 [u1x]=legendre_tr_eval(x,uloc,x1);
0081 [u1y]=legendre_tr_eval(y,u1x',y1);
0082     
0083 u_int(:,:,ie)=u1y;
0084 if command(1,1)~='c'
0085     ctx=jacx(ie)*x1+0.5*(xx(2,ie)+xx(1,ie));
0086 cty=jacy(ie)*y1+0.5*(yy(3,ie)+yy(1,ie));
0087 eval([command,'(ctx,cty,u1y)']);hold on
0088 %axis([-1,1,-1,1])
0089 alpha(1)
0090 end
0091  
0092 end
0093 ha=gca;
0094 set(ha,'Fontname','Times',...
0095     'FontSize',16,...
0096     'Xgrid','on','YGrid','on','Linewidth',2);
0097 
0098 if command(1,1)~='c'
0099     set(ha,'view',[-36,34])
0100 else
0101     cmin=min(min(min(u_int)));
0102     cmax=max(max(max(u_int)));
0103     caxis([cmin,cmax]);
0104     V=linspace(cmin,cmax,35);
0105     for ie=1:ne
0106     ctx=jacx(ie)*x1+0.5*(xx(2,ie)+xx(1,ie));
0107     cty=jacy(ie)*y1+0.5*(yy(3,ie)+yy(1,ie));
0108     u1=u_int(:,:,ie);
0109     
0110     contour(ctx,cty,u1,V,'LineWidth',2);
0111     end
0112 end
0113 end

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