Home > Src > Elliptic_1d > call_ell_1d.m

call_ell_1d

PURPOSE ^

CALL_ELL_1D Script to produce results of fig. 4.17, pag. 207, CHQZ2

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 CALL_ELL_1D Script to produce results of fig. 4.17, pag. 207, CHQZ2

 -nu d^2 u/dx^2 +du/dx=1  in (-1,1)

   u(-1)=u(1)=0


  Generalized Numerical integration, one element

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % CALL_ELL_1D Script to produce results of fig. 4.17, pag. 207, CHQZ2
0002 %
0003 % -nu d^2 u/dx^2 +du/dx=1  in (-1,1)
0004 %
0005 %   u(-1)=u(1)=0
0006 %
0007 %
0008 %  Generalized Numerical integration, one element
0009 %
0010 
0011 xa=-1;xb=1;  
0012 ub=[0,0];
0013 nu=1.d-2; beta=1;  gam=0; ff=@(x)[1];
0014 ne=1; cb='dd';
0015 nnx=[12,20,72]; % for nu=1.d-2
0016 
0017 fig=figure(...,
0018 'Name', 'Advection-diffusion solution nu=1.d-2',...
0019 'Visible','on')
0020 color=['k-.';'k--';'k- '];
0021 hold on
0022 knx=0;
0023 for nx=nnx
0024 [xy,un]=ell_1d(xa,xb,nu,beta,gam,ff,cb,ub,ne,nx);
0025 knx=knx+1;
0026 % evaluation of numerical solution at a finer grid to plot it
0027 nx1=100;
0028 x_int=xwlgl(nx1);
0029 [u_int]=legendre_tr_eval(xy,un,x_int);
0030 % evaluation of the polynomial at x_int (finer mesh with respect to x)
0031 if(knx<=3)
0032 h(knx)=plot(x_int,u_int,color(knx,:));
0033 else
0034 h(knx)=plot(xx,u1,color(knx,:));
0035 end
0036 end
0037 hl1=legend('N=12','N=20','N=72');
0038 set(hl1,'Position',[0.145,0.621,0.25,0.209]);
0039 set(gca,'XlimMode','manual','Xlim',[-1,1.001],...
0040 'YlimMode','manual','Ylim',[0,3])
0041 set(hl1,'FontName','Times','Fontsize',16);
0042 set(h(1),'Linewidth',1);
0043 set(h(2),'Linewidth',1);
0044 set(h(3),'Linewidth',2);
0045 set(gca,'PlotBoxAspectRatio',[3 2 1],...
0046 'Xgrid','on','XminorGrid','off','Ygrid','on',...
0047 'YminorGrid','off','LineWidth',1,...
0048 'FontName','Times','Fontsize',16)
0049 xlabel('x','FontName','Times','Fontsize',16)
0050 hold off
0051 
0052 
0053 nu=1.d-3; beta=1;  gam=0; ff=@(x)[1];
0054 ne=1;
0055 nnx=[48,72,104]; % for nu=1.d-2
0056 
0057 fig=figure(...,
0058 'Name', 'Advection-diffusion solution nu=1.d-3',...
0059 'Visible','on')
0060 color=['k-.';'k--';'k- '];
0061 hold on
0062 knx=0;
0063 for nx=nnx
0064 [xy,un]=ell_1d(xa,xb,nu,beta,gam,ff,cb,ub,ne,nx);
0065 knx=knx+1;
0066 % evaluation of numerical solution at a finer grid to plot it
0067 nx1=300;
0068 x_int=xwlgl(nx1);
0069 [u_int]=legendre_tr_eval(xy,un,x_int);
0070 % evaluation of the polynomial at x_int (finer mesh with respect to x)
0071 if(knx<=3)
0072 h(knx)=plot(x_int,u_int,color(knx,:));
0073 else
0074 h(knx)=plot(xx,u1,color(knx,:));
0075 end
0076 end
0077 hl1=legend('N=48','N=72','N=104');
0078 set(hl1,'Position',[0.145,0.621,0.25,0.209]);
0079 set(gca,'XlimMode','manual','Xlim',[-1,1.001],...
0080 'YlimMode','manual','Ylim',[0,3])
0081 set(hl1,'FontName','Times','Fontsize',16);
0082 set(h(1),'Linewidth',1);
0083 set(h(2),'Linewidth',1);
0084 set(h(3),'Linewidth',2);
0085 set(gca,'PlotBoxAspectRatio',[3 2 1],...
0086 'Xgrid','on','XminorGrid','off','Ygrid','on',...
0087 'YminorGrid','off','LineWidth',1,...
0088 'FontName','Times','Fontsize',16)
0089 xlabel('x','FontName','Times','Fontsize',16)
0090 hold off
0091 
0092 return

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