[cig-commits] commit: made more Benchmark plots and cleaned up basic options files

Mercurial hg at geodynamics.org
Thu May 29 11:26:23 PDT 2008


changeset:   133:97635524c180
user:        Marc Spiegelman <mspieg at ldeo.columbia.edu>
date:        Thu May 29 11:36:26 2008 -0400
files:       Benchmarks/Accuracy/getErrors.m Benchmarks/Accuracy/plotErrors.m src/swaves_fieldSplitPC.options src/swaves_fieldSplitPC_fluxBC.options
description:
made more Benchmark plots and cleaned up basic options files
M   Benchmarks/Accuracy/getErrors.m
M   Benchmarks/Accuracy/plotErrors.m
M   src/swaves_fieldSplitPC.options
A   src/swaves_fieldSplitPC_fluxBC.options


diff -r 756984d5461b -r 97635524c180 Benchmarks/Accuracy/getErrors.m
--- a/Benchmarks/Accuracy/getErrors.m	Wed May 28 23:26:50 2008 -0400
+++ b/Benchmarks/Accuracy/getErrors.m	Thu May 29 11:36:26 2008 -0400
@@ -1,23 +1,23 @@ function EStruct = getErrors(runroot)
 function EStruct = getErrors(runroot)
 % GETERRORS - get's all errors from a suite of runs and returns a structure
-%   
+%
 %   EStruct = getErrors(runroot)
 %
 %   runroot: leading string for run name (e.g. Accuracy2Dc=5)
 %   EStruct: 4x4 array of structures
-   
-   Dirs = dir([ runroot '*' ]);
-   for i = 1:length(Dirs)
-      name = Dirs(i).name;
-      cd(name);
-      subDirs = dir('cfl*');
-      for j = 1:length(subDirs);
-	 cd(subDirs(j).name);
-	 runname=[ name '_' subDirs(j).name ];
-	 EStruct(i,j).name = runname;
-	 EStruct(i,j).error = errorSolitaryWave2D(runname);
-	 cd ..
-      end
-      cd ..
-   end
-   
+
+Dirs = dir([ runroot '*' ]);
+for i = 1:length(Dirs)
+    name = Dirs(i).name;
+    cd(name);
+    subDirs = dir('cfl*');
+    for j = 1:length(subDirs);
+        cd(subDirs(j).name);
+        runname=[ name '_' subDirs(j).name ];
+        EStruct(i,j).name = runname;
+        EStruct(i,j).error = errorSolitaryWave2D(runname);
+        cd ..
+    end
+    cd ..
+end
+
diff -r 756984d5461b -r 97635524c180 Benchmarks/Accuracy/plotErrors.m
--- a/Benchmarks/Accuracy/plotErrors.m	Wed May 28 23:26:50 2008 -0400
+++ b/Benchmarks/Accuracy/plotErrors.m	Thu May 29 11:36:26 2008 -0400
@@ -1,61 +1,104 @@ function EStruct = plotErrors(runroot)
-function EStruct = plotErrors(runroot)
+function [EStruct, eEnd] = plotErrors(runroot)
 % PLOTERRORS - makes Pretty plots of convergence behavior for solitarywave runs
-%   
-%   EStruct = plotErrors(runroot)
+%
+%   [EStruct, eEnd] = plotErrors(runroot)
 %
 %   runroot: leading string for run name (e.g. Accuracy2Dc=5)
 %   EStruct: 4x4 array of structures
-   
-   ErrorFile = sprintf('%s_Errors.mat',runroot);
-   try
-      load(ErrorFile)
-   catch
-      EStruct = getErrors(runroot);
-      save(ErrorFile,'EStruct');
-   end
-   
-   [m, n] = size(EStruct);
-   
-   colors = {'r' 'b' 'g' 'k'};
-   styles = {'-' '--' '-.' ':'}; 
-   
-   f1=figure;
-   f2=figure;
-   k=1; % unpack the structure and plot
-   for j = 1:m
-      for i = 1:n
-	 name = EStruct(j,i).name;
-	 cfl = name(end);
-	 index = findstr(name,'=');
-	 nPerDel = name(index(end)+1);
-	 label{k}=sprintf('n=%s a=%s',nPerDel,cfl);
-	 linestyle = [ colors{j} styles{i} ];
-	 t=  EStruct(j,i).error.t;
-	 pErrors = EStruct(j,i).error.pErrorRel;
-	 vErrors = EStruct(j,i).error.vErrorRel;
-	 hold on
-	 figure(f1); plot(t,abs(pErrors),linestyle,'LineWidth',[1.5]);
-	 hold on
-	 figure(f2); plot(t,abs(vErrors),linestyle,'LineWidth',[1.5]);   
-	 k = k+1;   
-      end
-   end
-   
-   % and prettyfy
-   figure(f1);
-   set(gca,'fontweight','bold','fontsize',[14],'YScale','Log','XLim',[0 11])
-   legend(label,'Location','EastOutside');
-   xlabel('Time');
-   ylabel('Relative max porosity error');
-   title(sprintf('Relative Amplitude Errors: %s',runroot));
-   eval(sprintf('print -depsc2 %s_PErrors.eps',runroot));
-   
-   figure(f2);
-   set(gca,'fontweight','bold','fontsize',[14],'YScale','Log','XLim',[0 11])
-   legend(label,'Location','EastOutside');
-   xlabel('Time');
-   ylabel('Relative velocity error');
-   title(sprintf('Relative Velocity Errors: %s',runroot));
-   eval(sprintf('print -depsc2 %s_VErrors.eps',runroot));
+%   eEnd: 16x7 array of errors at tEnd eEnd(k,:) = [ j i cfl nPerDel pErrors(end) vErrors(end) t(end)] 
 
-   
+ErrorFile = sprintf('%s_Errors.mat',runroot);
+try
+    load(ErrorFile)
+catch
+    EStruct = getErrors(runroot);
+    save(ErrorFile,'EStruct');
+end
+
+[m, n] = size(EStruct);
+
+colors = {'r' 'b' 'g' 'k'};
+styles = {'-' '--' '-.' ':'};
+symbols = {'o' 's' '*' '^'};
+
+f1=figure;
+f2=figure;
+f3=figure;
+f4=figure;
+
+eEnd=zeros(m*n,7);
+k=1; % unpack the structure and plot
+for j = 1:m
+    for i = 1:n
+        name = EStruct(j,i).name;
+        cfl = str2double(name(end));
+        index = findstr(name,'=');
+        nPerDel = str2double(name(index(end)+1));
+        label{k}=sprintf('n=%d a=%d',nPerDel,cfl);
+        linestyle = [ colors{j} styles{i} ];
+        symbolstyle = [ colors{j} symbols{i} ];
+        t=  EStruct(j,i).error.t;
+        pErrors = EStruct(j,i).error.pErrorRel;
+        vErrors = EStruct(j,i).error.vErrorRel;
+        eEnd(k,:) = [ j i cfl nPerDel pErrors(end) vErrors(end) t(end)];
+        hold on
+        figure(f1); plot(t,abs(pErrors),linestyle,'LineWidth',[1.5]);
+        hold on
+        figure(f2); plot(t,abs(vErrors),linestyle,'LineWidth',[1.5]);
+        hold on
+        figure(f3); plot(cfl/nPerDel,abs(pErrors(end)),symbolstyle,'MarkerSize',15);
+        hold on
+        figure(f4); plot(cfl/nPerDel,abs(vErrors(end)),symbolstyle,'MarkerSize',15);
+        
+        k = k+1;
+    end
+end
+
+% and prettyfy
+figure(f1);
+set(gca,'fontweight','bold','fontsize',[14],'YScale','Log','XLim',[0 11])
+legend(label,'Location','EastOutside');
+xlabel('Time');
+ylabel('Relative max porosity error');
+title(sprintf('Relative Amplitude Errors: %s',runroot));
+eval(sprintf('print -depsc2 %s_PErrors.eps',runroot));
+
+figure(f2);
+set(gca,'fontweight','bold','fontsize',[14],'YScale','Log','XLim',[0 11])
+legend(label,'Location','EastOutside');
+xlabel('Time');
+ylabel('Relative velocity error');
+title(sprintf('Relative Velocity Errors: %s',runroot));
+eval(sprintf('print -depsc2 %s_VErrors.eps',runroot));
+
+figure(f3);
+% get best fit powerlaw exponent
+c=polyfit(log10(eEnd(:,3)./eEnd(:,4)),log10(abs(eEnd(:,5))),1)
+x=logspace(-1,1);
+rA=10^(c(2))*x.^c(1);
+hold on;
+plot(x,rA,'k');
+
+set(gca,'fontweight','bold','fontsize',[14],'XScale','Log','YScale','Log')
+grid;
+legend(label,'Location','EastOutside');
+xlabel('c\Delta t (\alpha/N)');
+ylabel('Relative Amplitude error');
+title(sprintf('Amplitude Error, t=%d, p=%f: %s',floor(t(end)),c(1),runroot));
+eval(sprintf('print -depsc2 %s_PErrors_End.eps',runroot));
+
+figure(f4);
+% get best fit powerlaw exponent
+c=polyfit(log10(eEnd(:,3)./eEnd(:,4)),log10(abs(eEnd(:,6))),1)
+x=logspace(-1,1);
+rE=10^(c(2))*x.^c(1);
+hold on;
+plot(x,rE,'k');
+
+set(gca,'fontweight','bold','fontsize',[14],'XScale','Log','YScale','Log')
+grid;
+legend(label,'Location','EastOutside');
+xlabel('c\Delta t (\alpha/N)');
+ylabel('Relative Velocity error');
+title(sprintf('Velocity Errors, t=%d, p=%f: %s',floor(t(end)),c(1),runroot));
+eval(sprintf('print -depsc2 %s_VErrors_End.eps',runroot));
diff -r 756984d5461b -r 97635524c180 src/swaves_fieldSplitPC.options
--- a/src/swaves_fieldSplitPC.options	Wed May 28 23:26:50 2008 -0400
+++ b/src/swaves_fieldSplitPC.options	Thu May 29 11:36:26 2008 -0400
@@ -6,26 +6,24 @@
 -dmmg_snes_monitor
 -output_file test
 -log_summary  SolitaryWave2D_summary_FSPC.log  
--amp 2
+-amp 3
 -z0 32
 -cfl 2 
--W0 -5
--t_max 1.
--t_output .5
+-W0 -7
+-t_max 5.
+-t_output 1.
 -noiseEps .005
 -quiet
--snes_atol 1.e-8
-#-ksp_rtol 5.e-3
--snes_ksp_ew
--snes_ksp_ew_version 3
+-ksp_rtol 1.e-4
+#-snes_ksp_ew
+#-snes_ksp_ew_version 2
 -useFieldSplitPC 
 -fieldsplit_0_mg_levels_ksp_type richardson
 -fieldsplit_0_mg_levels_pc_type sor
 -fieldsplit_0_mg_levels_ksp_max_it 2 
--fieldsplit_0_pc_mg_smoothdown 2
 -fieldsplit_0_pc_mg_type MULTIPLICATIVE
 -ksp_type richardson
-#-ksp_monitor
+-ksp_monitor
 -snes_converged_reason
 
 
diff -r 756984d5461b -r 97635524c180 src/swaves_fieldSplitPC_fluxBC.options
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/swaves_fieldSplitPC_fluxBC.options	Thu May 29 11:36:26 2008 -0400
@@ -0,0 +1,30 @@
+-mglevels 6
+-ni_coarse 4
+-nj_coarse 5
+-width 64
+-height 64
+-zBCFlag 1
+-dmmg_snes_monitor
+-output_file test
+-log_summary  SolitaryWave2D_summary_FSPC.log  
+-amp 3
+-z0 32
+-cfl 2 
+-W0 -7
+-t_max 5.
+-t_output 1.
+-noiseEps .005
+-quiet
+-ksp_rtol 5.e-3
+#-snes_ksp_ew
+#-snes_ksp_ew_version 3
+-useFieldSplitPC 
+-fieldsplit_0_mg_levels_ksp_type richardson
+-fieldsplit_0_mg_levels_pc_type sor
+-fieldsplit_0_mg_levels_ksp_max_it 2 
+-fieldsplit_0_pc_mg_type MULTIPLICATIVE
+-ksp_type richardson
+-ksp_monitor
+-snes_converged_reason
+
+



More information about the cig-commits mailing list