[cig-commits] r11390 - in long/3D/Gale/trunk: . input/benchmarks/sinusoid

walter at geodynamics.org walter at geodynamics.org
Mon Mar 10 11:45:28 PDT 2008


Author: walter
Date: 2008-03-10 11:45:28 -0700 (Mon, 10 Mar 2008)
New Revision: 11390

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/input/benchmarks/sinusoid/README
   long/3D/Gale/trunk/input/benchmarks/sinusoid/munch_data.cxx
   long/3D/Gale/trunk/input/benchmarks/sinusoid/sinusoid.xml
Log:
 r2023 at earth:  boo | 2008-03-07 15:59:42 -0800
 Fix up sinusoid benchmark



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2022
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2023

Modified: long/3D/Gale/trunk/input/benchmarks/sinusoid/README
===================================================================
--- long/3D/Gale/trunk/input/benchmarks/sinusoid/README	2008-03-10 18:45:24 UTC (rev 11389)
+++ long/3D/Gale/trunk/input/benchmarks/sinusoid/README	2008-03-10 18:45:28 UTC (rev 11390)
@@ -1,26 +1,42 @@
-# Run the simulation in low, medium, and high resolution
+# Run the simulation in low, medium, and high resolution.  This will
+# probably require a parallel computer.  I ran the largest case with
+# 128 processors, although you could probably get away with less than
+# that.
 
-./Gale sinusoid.xml --elementResI=16 --elementResJ=32 --maxY=2.0 --outputPath=low --maxTimeSteps=3
-./Gale sinusoid.xml --elementResI=32 --elementResJ=64 --maxY=2.0 --outputPath=medium --maxTimeSteps=5
-./Gale sinusoid.xml --elementResI=64 --elementResJ=128 --maxY=2.0 --outputPath=high --maxTimeSteps=10
+./Gale sinusoid.xml --elementResI=128 --elementResJ=256 --outputPath=low --maxTimeSteps=1
+./Gale sinusoid.xml --elementResI=256 --elementResJ=512 --outputPath=medium --maxTimeSteps=2
+./Gale sinusoid.xml --elementResI=512 --elementResJ=1024 --outputPath=high --maxTimeSteps=4
 
-# Make the data suitable for plotting
+# Compute the errors in the data
 
 make
-./munch_data
+./munch_data low 1
+./munch_data medium 2
+./munch_data high 4
 
-# Run "ipython -pylab" and copy/paste the following lines to create
-# the plot
 
-low=load("low/error")
-medium=load("medium/error")
-high=load("high/error")
+# start gnuplot and copy+paste in the following
 
-plot(low[:,0],abs(low[:,1]-0.1*exp(-low[:,0]/(4*pi))),label="low 16x32")
-plot(medium[:,0],abs(medium[:,1]-0.1*exp(-medium[:,0]/(4*pi))),label="medium 32x64")
-plot(high[:,0],abs(high[:,1]-0.1*exp(-high[:,0]/(4*pi))),label="high 64x128")
+set key top left
+set xlabel "Time"
+set ylabel "Error"
+plot "low/error" using 1:2 w l title "128x256", "medium/error" using 1:($2) w l title "256x512", "high/error" using 1:($2) w l title "512x1024"
 
+# Copy+paste the following for the scaled error
 
-legend(loc="upper left")
-xlabel('Time')
-ylabel('Error')
+set ylabel "Scaled Error"
+plot "low/error" using 1:2 w l title "128x256", "medium/error" using 1:($2*2) w l title "256x512", "high/error" using 1:($2*4) w l title "512x1024"
+
+
+The errors should be something like
+
+1024_32:
+         0.607817:  1.09415625e-5
+         1.24678 :  2.1991585e-5
+         1.92025 :  3.311948754e-5
+         2.63245 :  4.413674631e-5
+
+512_8:   1.21568 :  4.402745855e-5
+         2.56261 :  8.866860671e-5
+
+256_8:   2.43147 :  1.7350621691e-4

Modified: long/3D/Gale/trunk/input/benchmarks/sinusoid/munch_data.cxx
===================================================================
--- long/3D/Gale/trunk/input/benchmarks/sinusoid/munch_data.cxx	2008-03-10 18:45:24 UTC (rev 11389)
+++ long/3D/Gale/trunk/input/benchmarks/sinusoid/munch_data.cxx	2008-03-10 18:45:28 UTC (rev 11390)
@@ -4,16 +4,17 @@
 #include <utility>
 #include <sstream>
 #include <fstream>
+#include <cmath>
 
 using namespace std;
 
 
-void read_files(const string &dir, vector<pair<double,double> > &data,
+void read_files(const string &dir,
                 const int steps, const double &offset)
 {
   ofstream error((dir+"/error").c_str());
   /* Manually put in t=0 */
-  error << "0 0.1\n";
+  error << "0 0\n";
   for(int i=1;i<=steps;++i)
     {
       double time, height;
@@ -35,6 +36,7 @@
         s.fill('0');
         s << i << ".dat";
         ifstream vfile(s.str().c_str());
+        cout << s.str() << " " << steps << endl;
         while(vfile)
           {
             double n, z, v, x, y;
@@ -43,18 +45,22 @@
               height=y;
           }
       }
-      data.push_back(make_pair(time,height));
 
-      error << time << " " << height-offset << "\n";
+      const double starting_height(0.01);
+      const double pi(4*atan(1.0));
+
+      error << time << " "
+            << abs(exp(-time/(4*pi))*starting_height + (height-offset))
+            << "\n";
     }
 }
 
 
-int main()
+int main(int argc, char* argv[])
 {
-  vector<pair<double,double> > low, medium, high;
-
-  read_files("low",low,3,2.0);
-  read_files("medium",medium,5,2.0);
-  read_files("high",high,10,2.0);
+  for(int i=1;i<argc;i+=2)
+    {
+      int num_steps=atoi(argv[i+1]);
+      read_files(argv[i],num_steps,1.0);
+    }      
 }

Modified: long/3D/Gale/trunk/input/benchmarks/sinusoid/sinusoid.xml
===================================================================
--- long/3D/Gale/trunk/input/benchmarks/sinusoid/sinusoid.xml	2008-03-10 18:45:24 UTC (rev 11389)
+++ long/3D/Gale/trunk/input/benchmarks/sinusoid/sinusoid.xml	2008-03-10 18:45:28 UTC (rev 11390)
@@ -267,7 +267,7 @@
     <struct name="uzawa">
       <param name="Type">Stokes_SLE_UzawaSolver</param>
       <param name="Preconditioner">preconditioner</param>
-      <param name="tolerance">1.0e-5</param>
+      <param name="tolerance">linearTolerance</param>
       <param name="maxIterations">5000</param>
     </struct>
     <struct name="stokesEqn">
@@ -335,7 +335,7 @@
       <list name="origin">
         <param>0.0</param>
       </list>
-      <param name="amplitude">0.1</param>
+      <param name="amplitude">0.01</param>
       <param name="frequency">6.28318530718</param>
     </struct>
     <struct name="escapedRoutine">
@@ -377,8 +377,8 @@
   <param name="minX">0.0f</param>
   <param name="minY">0.0f</param>
   <param name="minZ">0.0f</param>
-  <param name="maxX">1.0f</param>
-  <param name="maxY">0.5f</param>
+  <param name="maxX">0.5f</param>
+  <param name="maxY">1.0f</param>
   <param name="maxZ">0.3f</param>
   <param name="elementResI">32</param>
   <param name="elementResJ">16</param>
@@ -481,4 +481,9 @@
   </struct>
   <param name="checkpointEvery">1</param>
   <param name="gravity">1.</param>
+  <param name="linearTolerance">1.0e-5</param>
+<!--   <param name="journal.info">True</param> -->
+<!--   <param name="journal.debug">True</param> -->
+<!--   <param name="journal-level.info">2</param> -->
+<!--   <param name="journal-level.debug">2</param> -->
 </StGermainData>



More information about the cig-commits mailing list