function [s,m] =  ppe(s,m,par,nt,nx,ny,xw,yw,output_dir,test_id);

s.sedero = s.zb(:,end)-s.zb(:,1);
m.sedero = m.z(6,:)-m.z(1,:);

x= 0:1:230; dx = 1;
hours = [0.1 0.3 1.0 2.04 6.0];
m.hours2 = [0.0 0.1 0.3 1.0 2.04 6.0];
indh = []; indh(1) = 1;
indh(2:6) = round(hours*3600/par.morfac/par.tint);

% compute erosion volumes above maximum still water level
m.A = zeros(1,6); s.A = m.A;
for i = 2:6;
    m.A(i) = sum(max(0,m.z(1,:))-max(0,m.z(i,:)))*dx;
    s.A(i) = sum(max(0,s.zb(:,1))-max(0,s.zb(:,indh(i))))*dx;
end

figure(20); subplot(211); set(gca,'FontSize',10);
for i = 1:6
    plot(x,m.z(i,:),'k'); hold on;
    plot(xw,s.zb(:,indh(i)),'k--','LineWidth',1.5);
end
plot([0 xw(end)],[0 0],'k')
xlabel('x [m]'); ylabel('z_{b} [m]'); axis([0 max(xw) -4.5 2]);
% titletext = ['Simulated profile evolution (dashed lines) compared with measured profile evolu-tion (solid lines) after t = 0.0, 0.1, 0.3, 1.0, 2.04 and 6.0 hours.'];
% tt = title_text(titletext);
% title (tt,'FontSize',9);

pname = [output_dir,test_id '_fig14.png'];
eval(['print -dpng ' pname]);
pname = [output_dir,test_id '_fig14.eps'];
eval(['print -depsc2 ' pname]);
pname = [output_dir,test_id '_fig14.fig'];
saveas(gcf, pname, 'fig');

figure(21); subplot(211); set(gca,'FontSize',10);
for i = 1:6
    plot(x,m.z(i,:),'k'); hold on;
    plot(xw,s.zb(:,indh(i)),'k--','LineWidth',1.5);
end
plot([0 xw(end)],[0 0],'k');
xlabel('x [m]'); ylabel('z_{b} [m]'); axis([160 max(xw) -2.0 2]);
% titletext = ['Simulated profile evolution (dashed lines) compared with measured profile evolu-tion (solid lines) after t = 0.0, 0.1, 0.3, 1.0, 2.04 and 6.0 hours.'];
% tt = title_text(titletext);
% title (tt,'FontSize',9);
pname = [output_dir,test_id '_fig15.png'];
eval(['print -dpng ' pname]);
pname = [output_dir,test_id '_fig15.eps'];
eval(['print -depsc2 ' pname]);
pname = [output_dir,test_id '_fig15.fig'];
saveas(gcf, pname, 'fig');

figure(22); subplot(211); set(gca,'FontSize',10);
plot(x,m.sedero,'k'); hold on;
plot(xw,s.sedero,'k--','LineWidth',1.5);
xlabel('x [m]'); ylabel('sedero [m]'); axis([160 max(xw) -2 1]);
% titletext = [''];
% tt = title_text(titletext);
% title (tt,'FontSize',9);
pname = [output_dir,test_id '_fig16.png'];
eval(['print -dpng ' pname]);
pname = [output_dir,test_id '_fig16.eps'];
eval(['print -depsc2 ' pname]);
pname = [output_dir,test_id '_fig16.fig'];
saveas(gcf, pname, 'fig');

figure(23); set(gca,'FontSize',16);
plot(m.hours2,m.A(1,:),'k-s','LineWidth',1.5,'MarkerFaceColor','k'); hold on;
plot(m.hours2,s.A(1,:),'k--s','LineWidth',1.5,'MarkerSize',12);
xlabel('t [hours]'); ylabel('A [m^3/m]');
% titletext = ['Simulated dune erosion volume above still water level (dashed line with open squares) compared with the measured dune erosion volume (solid lines with closed squares) as function of time.'];
% tt = title_text(titletext);
% title (tt,'FontSize',9);
pname = [output_dir,test_id '_fig17.png'];
eval(['print -dpng ' pname]);
pname = [output_dir,test_id '_fig17.eps'];
eval(['print -depsc2 ' pname]);
pname = [output_dir,test_id '_fig17.fig'];
saveas(gcf, pname, 'fig');


