% TIME % explicit timeintegration for a convection-diffusionequation % grids uniform, exponentially stretched, and abrupt % two discretisationmethods (A and B) % Date : 20 Mei 2004 % Author : A.E.P. Veldman %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Calling sequence: % % m-file input files output files % % time.m uvpf####.dat % | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % GLOBAL variables global panel_discr panel_timestep panel_tfin panel_points panel_diff global panel_grid panel_stretch plotfig % define main control window close(figure(1)) lqfig=figure(1); clf reset set(lqfig, ... 'NumberTitle', 'off', ... 'MenuBar', 'none', ... 'Name', 'Timeintegration Control Panel', ... 'Position', [10 50 270 450], ... 'Units', 'normal', ... 'Resize','off'); % define plot windows %close(figure(2)) %plotfg=figure(2); %close(figure(3)) %plotfg=figure(3); %close(figure(4)) %plotfg=figure(4); % define colors bordercolor=[0.25 0.25 0.25]; buttoncolor=[0.775 0.775 0.775]; editcolor=[0.95 0.95 0.95]; errorcolor=[1.0 0.5 0.5]; lower=50; % frame uicontrol(lqfig,'Style','frame', ... 'Position',[0 0 270 lower+400]); % diffusion coefficient panel_difftxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+350 100 25], ... 'Fontsize', 14 , ... 'String','diffusion ', ... 'Visible','on', ... 'Horizontal','left'); panel_diff=uicontrol(lqfig,'Style','edit', ... 'Fontsize', 14 , ... 'String','0.01', ... 'Position',[140,lower+350,50,30], ... 'Visible','on', ... 'Background',editcolor, ... 'Horizontal','left'); % choice of discretization method panel_discrtxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+300 125 25], ... 'Fontsize', 14 , ... 'String','discretization ', ... 'Visible','on', ... 'Horizontal','left'); panel_discr=uicontrol(lqfig,'Style','popup', ... 'Position',[140 lower+300 120 28], ... 'Fontsize', 14 , ... 'String',['Method A | Method B '], ... 'Value', 2, ... 'Background',buttoncolor, ... 'Horizontal','center'); % choice of grid panel_gridtxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+260 100 25], ... 'Fontsize', 14 , ... 'String','grid type ', ... 'Visible','on', ... 'Horizontal','left'); panel_grid=uicontrol(lqfig,'Style','popup', ... 'Position',[140 lower+260 120 28], ... 'Background',buttoncolor, ... 'Fontsize', 14 , ... 'String', [' uniform | stretched | abrupt '], ... 'Horizontal','center', ... 'Value', 1, ... 'CallBack', ['if get(panel_grid,''Value'') == 2 | ' ... 'get(panel_grid,''Value'') == 3 , ' ... 'set(panel_stretch,''Visible'',''on''), '... 'set(panel_stretchtxt1,''Visible'',''on''), '... 'set(panel_stretchtxt2,''Visible'',''on''), '... 'else,' ... 'set(panel_stretch,''Visible'',''off''), '... 'set(panel_stretchtxt1,''Visible'',''off''), '... 'set(panel_stretchtxt2,''Visible'',''off''), '... 'end' ] ); % control of stretching panel_stretchtxt1=uicontrol(lqfig,'Style','text', ... 'Position',[120 lower+237 85 25], ... 'Fontsize', 14 , ... 'String',' "mid" ', ... 'Visible','off', ... 'Horizontal','right'); panel_stretch=uicontrol(lqfig,'Style','edit', ... 'Fontsize', 14 , ... 'String','10', ... 'Position',[205,lower+235,30,30], ... 'Visible','off', ... 'Background',editcolor, ... 'Horizontal','left'); panel_stretchtxt2=uicontrol(lqfig,'Style','text', ... 'Position',[230 lower+237 30 25], ... 'Fontsize', 14 , ... 'String',' k', ... 'Visible','off', ... 'Horizontal','left'); % parametervalues % number of grid points panel_pointstxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+205 100 25], ... 'Fontsize', 14 , ... 'String','grid points ', ... 'Visible','on', ... 'Horizontal','left'); panel_points=uicontrol(lqfig,'Style','edit', ... 'Fontsize', 14 , ... 'String','100', ... 'Position',[140,lower+205,50,30], ... 'Visible','on', ... 'Background',editcolor, ... 'Horizontal','left'); % end time panel_tfintxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+160 100 25], ... 'Fontsize', 14 , ... 'String','end time ', ... 'Visible','on', ... 'Horizontal','left'); panel_tfin=uicontrol(lqfig,'Style','edit', ... 'Fontsize', 14, ... 'String','50.0', ... 'Position',[140,lower+160,50,30], ... 'Visible','on', ... 'Background',editcolor, ... 'Horizontal','left'); % time step panel_timesteptxt=uicontrol(lqfig,'Style','text', ... 'Position',[15 lower+130 100 25], ... 'Fontsize', 14 , ... 'String','time step ', ... 'Visible','on', ... 'Horizontal','left'); panel_timestep=uicontrol(lqfig,'Style','edit', ... 'Fontsize', 14, ... 'String','0.25', ... 'Position',[140,lower+130,50,30], ... 'Visible','on', ... 'Background',editcolor, ... 'Horizontal','left'); %%%%%%%%%%%%%%%%% RESULTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % show steady solution panel_go=uicontrol(lqfig,'Style','push', ... 'Position',[50 lower+70 180 30], ... 'Fontsize', 14 , ... 'String','STEADY SOLUTION', ... 'Background',buttoncolor, ... 'CallBack',[' integrate(1);'] ); % time integration panel_go=uicontrol(lqfig,'Style','push', ... 'Position',[50 lower+10 180 40], ... 'Fontsize', 14 , ... 'String','INTEGRATE', ... 'Background',buttoncolor, ... 'CallBack',[' integrate(2);'] ); % show eigenvalues panel_go=uicontrol(lqfig,'Style','push', ... 'Position',[50 10 180 30], ... 'Fontsize', 14 , ... 'String','EIGENVALUES', ... 'Background',buttoncolor, ... 'CallBack',[' integrate(3);'] );