clear all close all addpath(genpath('E:\My software')); pp0=cd; % nam = {'zb';'H';'zs';'zs0';'u'}; % % %% dimensions % fid = fopen([dir,'dims.dat'],'r'); % temp = fread(fid,[3,1],'double'); % par.nt = temp(1); % par.nx = temp(2)+1; % par.ny = temp(3)+1; % fclose(fid); % % %% read grid coordinates % fid = fopen([dir,'xy.dat'],'r'); % d.xw = fread(fid,[par.nx,par.ny],'double'); % d.yw = fread(fid,[par.nx,par.ny],'double'); % d.x = fread(fid,[par.nx,par.ny],'double'); % d.y = fread(fid,[par.nx,par.ny],'double'); % % fclose(fid); % % for j = 1:length(nam) % temp = zeros(par.nx,par.ny,par.nt); % fid = fopen([dir,nam{j},'.dat'],'r'); % for i = 1:par.nt % temp(:,:,i) = fread(fid,[par.nx,par.ny],'double'); % all data % end % fclose(fid); % d.(nam{j}) = zeros(par.nx,par.nt); % d.(nam{j}) = squeeze(temp(:,2,:)); % end pps={'Run1M_00';'Run1M_00_facua02';'Run1M_00_wetslope';'Run1M_both';'Run1M_longshore';'Run1M_longshore_Cz';'Run1M_longwaves';'Run1M_perpendicular';'Run1M_irregular'}; labs={'simple';'facua 0.2';'wetslope 0.2';'both';'longshore';'longshore-Cz=0.5';'longwaves';'perpendicular';'irregular'}; for iii=1:length(labs) cd(fullfile(pp0,pps{iii})) fid = fopen('dims.dat','r'); nt = fread(fid,[1],'double'); nx = fread(fid,[1],'double'); ny = fread(fid,[1],'double'); fclose(fid); fixy = fopen('xy.dat','r'); x = fread(fid,[nx+1,ny+1],'double'); y = fread(fid,[nx+1,ny+1],'double'); fclose(fixy); xx=x(:,1); yy=y(:,1); fib=fopen('zb.dat','r'); for i=1:nt; d=fread(fib,[nx+1,ny+1],'double'); end fclose(fib) % read final model profile fdp2=d(:,1) runres(iii).nt=nt; runres(iii).nx=nx; runres(iii).ny=ny; runres(iii).x=xx(:); runres(iii).y=yy(:); runres(iii).final=fdp2(:); runres(iii).leg=labs{iii}; end cd .. load profs_2 ic=make_icol_scheme; dx=2; load(['start.dep']) nst = start(1,:); % load(['final.dep']) % % nfin = final(1,:); % lf=length(nst); % lf2=length(nfin); % % subplot(5,1,i) xx=([1:lf]-1)*dx; % xx2=([1:lf2]-1)*dx; leg2={'Initial','Final'}; for i=1:length(labs) figure(i) pp=plot(xx,nst,'color',ic(:,1)); set(pp,'Linewidth',2) hold on % pp=plot(xx2,nfin,'color',ic(:,2)); set(pp,'Linewidth',2) % end pp=plot(prof(5).x2,flipud(prof(5).z2),'color',ic(:,2)); set(pp,'Linewidth',2) % add formating xlabel('Cross-shore distance (m)');ylabel('Elevation (m)');%title(['wave condition ' num2str(ii) ' iter ' num2str(i) '/' num2str(nt)]); grid on box on plot(runres(i).x,runres(i).final,'color',ic(:,3)) axis([1000 1600 -5 8]) % leg={'Initial','Final'}; leg={'Initial','Final',labs{i}}; legend(leg,2) % % set limits % yl1=-6 ; % yl2=8; % % xx=repres(i).x; % nst=repres(i).z; % % % inds=find(nst>yl1 & nst < yl2); % % xl1=min(xx(inds)); % xl2=max(xx(inds)); % axis([xl1 xl2 yl1 yl2]) % % plot([xl1 xl2],[2 2],'k') figure(100) if i==1 pp=plot(xx,nst,'color','k'); set(pp,'Linewidth',2) hold on % pp=plot(xx2,nfin,'color',ic(:,2)); set(pp,'Linewidth',2) % end pp=plot(prof(5).x2,flipud(prof(5).z2),'color',[0.5 0.5 0.5]); set(pp,'Linewidth',2) end axis([1000 1600 -5 8]) % add formating xlabel('Cross-shore distance (m)');ylabel('Elevation (m)');%title(['wave condition ' num2str(ii) ' iter ' num2str(i) '/' num2str(nt)]); grid on box on plot(runres(i).x,runres(i).final,'color',ic(:,i)) % leg={'Initial','Final'}; leg2{i+2}=labs{i}; legend(leg2,2) end field save(fullfile(pp0,'run_summary.mat'),'runres')