Index: /anuga_work/development/anuga_1d/config.py
===================================================================
--- /anuga_work/development/anuga_1d/config.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/config.py	(revision 5741)
@@ -11,5 +11,6 @@
 
 min_timestep = 1.0e-6 #Should be computed based on geometry
-max_timestep = 1000
+max_timestep = 1.0e3
+max_smallsteps = 50  # Max number of degenerate steps allowed b4 trying first order
 #This is how:
 #Define maximal possible speed in open water v_max, e.g. 500m/s (soundspeed?)
Index: /anuga_work/development/anuga_1d/dam_h_elevation.py
===================================================================
--- /anuga_work/development/anuga_1d/dam_h_elevation.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/dam_h_elevation.py	(revision 5741)
@@ -1,5 +1,5 @@
 import os
 from math import sqrt, sin, cos, pi, exp
-from shallow_water_domain import *
+from shallow_water_domain_new import *
 from Numeric import zeros, Float
 #from analytic_dam_sudi import AnalyticDam
@@ -42,5 +42,6 @@
 
 domain.default_order = 2
-domain.default_time_order = 1
+domain.set_timestepping_method('euler')
+#domain.default_time_order = 2
 domain.cfl = 1.0
 domain.limiter = "vanleer"
Index: /anuga_work/development/anuga_1d/domain.py
===================================================================
--- /anuga_work/development/anuga_1d/domain.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/domain.py	(revision 5741)
@@ -724,5 +724,7 @@
     #--------------------------    
 
-    def evolve(self, yieldstep = None, finaltime = None, duration = None,
+    def evolve(self, yieldstep = None,
+               finaltime = None,
+               duration = None,
                skip_initial_step = False):
         """Evolve model through time starting from self.starttime.
@@ -759,7 +761,4 @@
 
         from config import min_timestep, max_timestep, epsilon
-
-        print 'yieldstep', yieldstep
-        print 'duration', duration
 
         # FIXME: Maybe lump into a larger check prior to evolving
@@ -1388,9 +1387,9 @@
     def update_timestep(self, yieldstep, finaltime):
 
-        from config import min_timestep
+        from config import min_timestep, max_timestep
 
         # self.timestep is calculated from speed of characteristics
         # Apply CFL condition here
-        timestep = self.CFL*self.timestep
+        timestep = min(self.CFL*self.flux_timestep, max_timestep)
 
         #Record maximal and minimal values of timestep for reporting
@@ -1459,5 +1458,5 @@
     
     #def update_conserved_quantities(self):
-    def update_conserved_quantities(self,timestep):
+    def update_conserved_quantities(self):
         """Update vectors of conserved quantities using previously
         computed fluxes specified forcing functions.
@@ -1469,8 +1468,8 @@
         d = len(self.conserved_quantities)
 
-        #timestep = self.timestep
+        timestep = self.timestep
 
         #Compute forcing terms
-        #self.compute_forcing_terms()
+        self.compute_forcing_terms()
 
         #Update conserved_quantities
@@ -1479,14 +1478,5 @@
             Q.update(timestep)
 
-            #Clean up
-            #Note that Q.explicit_update is reset by compute_fluxes
-
-            #MH090605 commented out the following since semi_implicit_update is now re-initialized
-            #at the end of the _update function in quantity_ext.c (This is called by the
-            #preceeding Q.update(timestep) statement above).
-            #For run_profile.py with N=128, the time of update_conserved_quantities is cut from 14.00 secs
-            #to 8.35 secs
-
-            #Q.semi_implicit_update[:] = 0.0
+
 
 if __name__ == "__main__":
Index: /anuga_work/development/anuga_1d/quantity.py
===================================================================
--- /anuga_work/development/anuga_1d/quantity.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/quantity.py	(revision 5741)
@@ -861,6 +861,6 @@
         #backup_centroid_values(self)
         N = self.domain.number_of_elements
-        for i in range(self.N):
-            quantity.centroid_backup_values[i] = quantity.centroid_values[i]
+        for i in range(N):
+            self.centroid_backup_values[i] = self.centroid_values[i]
 
     def saxpy_centroid_values(self,a,b):
@@ -869,6 +869,6 @@
         #saxpy_centroid_values(self,a,b)
         N = self.domain.number_of_elements
-        for i in range(self.N):
-            quantity.centroid_backup_values[i] = a*quantity.centroid_values[i] + b*quantity.centroid_backup_values[i]        
+        for i in range(N):
+            self.centroid_backup_values[i] = a*self.centroid_values[i] + b*self.centroid_backup_values[i]        
 
 class Conserved_quantity(Quantity):
Index: /anuga_work/development/anuga_1d/shallow_water_domain.py
===================================================================
--- /anuga_work/development/anuga_1d/shallow_water_domain.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/shallow_water_domain.py	(revision 5741)
@@ -575,5 +575,5 @@
         #print "flux cell",k,flux[0]
 
-    domain.timestep = timestep
+    domain.flux_timestep = timestep
     #print domain.quantities['stage'].centroid_values
 
@@ -652,5 +652,5 @@
         from comp_flux_ext import compute_fluxes_ext
 	
-	domain.timestep = compute_fluxes_ext(timestep,
+	domain.flux_timestep = compute_fluxes_ext(timestep,
                                   epsilon,
                                   g,
@@ -685,5 +685,5 @@
         from comp_flux_ext import compute_fluxes_ext_short
 
- 	domain.timestep = compute_fluxes_ext_short(timestep,domain,stage,xmom,bed)
+ 	domain.flux_timestep = compute_fluxes_ext_short(timestep,domain,stage,xmom,bed)
 
 
Index: /anuga_work/development/anuga_1d/shallow_water_domain_new.py
===================================================================
--- /anuga_work/development/anuga_1d/shallow_water_domain_new.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/shallow_water_domain_new.py	(revision 5741)
@@ -165,5 +165,7 @@
         distribute_to_vertices_and_edges(self)
         
-    def evolve(self, yieldstep = None, finaltime = None,
+    def evolve(self, yieldstep = None,
+               finaltime = None,
+               duration = None,
                skip_initial_step = False):
         """Specialisation of basic evolve method from parent class
@@ -172,5 +174,5 @@
         self.distribute_to_vertices_and_edges()
         
-        for t in Generic_Domain.evolve(self, yieldstep, finaltime,
+        for t in Generic_Domain.evolve(self, yieldstep, finaltime, duration,
                                        skip_initial_step):
             #Pass control on to outer loop for more specific actions
@@ -439,5 +441,5 @@
         
 
-    domain.timestep = timestep
+    domain.flux_timestep = timestep
     #print domain.quantities['stage'].centroid_values
 
@@ -468,5 +470,5 @@
         from comp_flux_ext import compute_fluxes_ext
 	
-	domain.timestep = compute_fluxes_ext(timestep,
+	domain.flux_timestep = compute_fluxes_ext(timestep,
                                   epsilon,
                                   g,
@@ -501,5 +503,5 @@
         from comp_flux_ext import compute_fluxes_ext_short
 
- 	domain.timestep = compute_fluxes_ext_short(timestep,domain,stage,xmom,bed)
+ 	domain.flux_timestep = compute_fluxes_ext_short(timestep,domain,stage,xmom,bed)
 
 
@@ -526,7 +528,7 @@
 	max_speed_array = domain.max_speed_array
 	        
-        from comp_flux_ext_wellbalanced import compute_fluxes_ext_wellbalanced                  #from comp_flux_ext import compute_fluxes_ext
+        from comp_flux_ext_wellbalanced import compute_fluxes_ext_wellbalanced  #from comp_flux_ext import compute_fluxes_ext
 	
-	domain.timestep = compute_fluxes_ext_wellbalanced(timestep,
+	domain.flux_timestep = compute_fluxes_ext_wellbalanced(timestep,
                                   epsilon,
                                   g,
Index: /anuga_work/development/anuga_1d/test_shallow_water.py
===================================================================
--- /anuga_work/development/anuga_1d/test_shallow_water.py	(revision 5740)
+++ /anuga_work/development/anuga_1d/test_shallow_water.py	(revision 5741)
@@ -5,6 +5,6 @@
 
 
-from shallow_water_domain import *
-from shallow_water_domain import flux_function as domain_flux_function
+from shallow_water_domain_new import *
+from shallow_water_domain_new import flux_function as domain_flux_function
 
 from Numeric import allclose, array, ones, Float, maximum, zeros
@@ -41,5 +41,5 @@
         #print domain.quantities['stage'].explicit_update
         #print domain.quantities['xmomentum'].explicit_update
-        #print stage_ud
+        print stage_ud
 
         assert allclose( domain.quantities['stage'].explicit_update, stage_ud )
@@ -133,5 +133,6 @@
 
         domain.default_order = 1
-        domain.default_time_order = 1
+        domain.set_timestepping_method('euler')
+        
         yieldstep=1.0
         finaltime=1.0
@@ -167,5 +168,5 @@
 
         domain.default_order = 2
-        domain.default_time_order = 1
+        domain.set_timestepping_method('rk2')
         yieldstep=1.0
         finaltime=1.0
@@ -191,5 +192,6 @@
 
         domain.default_order = 2
-        domain.default_time_order = 2
+        domain.set_timestepping_method('rk3')
+
         yieldstep=1.0
         finaltime=1.0
Index: /anuga_work/development/demos/netherlands.py
===================================================================
--- /anuga_work/development/demos/netherlands.py	(revision 5740)
+++ /anuga_work/development/demos/netherlands.py	(revision 5741)
@@ -27,5 +27,5 @@
 N = 130 # size = 33800
 N = 600 # Size = 720000
-N = 100
+N = 50
 
 points, elements, boundary = rectangular_cross(N, N)
@@ -34,6 +34,9 @@
 domain.check_integrity()
 
+import sys
+base = os.path.basename(sys.argv[0])
+domain.simulation_name = 'netherlands'
 domain.set_name(os.path.splitext(__file__)[0])
-domain.set_timestepping_method('rk3')
+domain.set_timestepping_method('rk2')
 domain.set_default_order(2)
 domain.set_store_vertices_uniquely(True) # Store as internally represented
@@ -130,4 +133,16 @@
 domain.set_boundary({'left': Bd, 'right': Br, 'bottom': Br, 'top': Br})
 
+#-------------------------------------------------------------------------------
+# Copy scripts to time stamped output directory and capture screen
+# output to file
+#-------------------------------------------------------------------------------
+time = strftime('%Y%m%d_%H%M%S',localtime())
+
+output_dir = 'dam_break_'+time
+output_file = 'dam_break'
+
+copy_code_files(output_dir,__file__)
+#start_screen_catcher(output_dir+'_')
+
 
 #------------------------------------------------------------------------------
@@ -139,10 +154,17 @@
     # Initialise real-time visualiser 
 
-    pass
-    #vis = RealtimeVisualiser(domain)
-    #vis.render_quantity_height("elevation", dynamic=False)
-    #vis.render_quantity_height("stage", dynamic=True)
-    #vis.colour_height_quantity('stage', (0.0, 0.0, 0.8))
-    #vis.start()
+    #pass
+    visualise = True
+    if visualise:
+        from anuga.visualiser import RealtimeVisualiser
+        vis = RealtimeVisualiser(domain)
+        vis.render_quantity_height("elevation", offset=0.01, dynamic=False)
+        vis.render_quantity_height("stage", dynamic=True)
+        vis.colour_height_quantity('stage', (0.2, 0.2, 0.8))
+        vis.start()
+        import time
+        time.sleep(2.0)
+    
+    
 
 
@@ -151,16 +173,14 @@
 t0 = time.time()
 
-for t in domain.evolve(yieldstep = 0.005, finaltime = None):
+for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
     print domain.timestepping_statistics()
-    print domain.quantities['stage'].get_values(location='centroids',
-                                                indices=[0])
-						
-    #vis.update()						
-    #time.sleep(0.1)
-    #raw_input('pause>')
-    #V.update_quantity('stage')
-    #rpdb.set_active()
-    #integral_label.text='Integral=%10.5e'%domain.quantities['stage'].get_integral()
-#vis.evolveFinished()
+    #print domain.quantities['stage'].get_values(location='centroids',
+                                                #indices=[0])
+    if visualise:
+        vis.update()						
+
+        
+
+if visualise: vis.evolveFinished()
 
 print 'That took %.2f seconds' %(time.time()-t0)
Index: /anuga_work/development/shallow_water_1d_old/quantity.py
===================================================================
--- /anuga_work/development/shallow_water_1d_old/quantity.py	(revision 5740)
+++ /anuga_work/development/shallow_water_1d_old/quantity.py	(revision 5741)
@@ -56,4 +56,24 @@
         #Intialise centroid values
         self.interpolate()
+
+
+        from Numeric import zeros, Float
+        
+        #Allocate space for boundary values
+        #L = len(domain.boundary)
+        self.boundary_values = zeros(2, Float) #assumes no parrellism
+
+        #Allocate space for updates of conserved quantities by
+        #flux calculations and forcing functions
+        
+        N = domain.number_of_elements
+        self.explicit_update = zeros(N, Float )
+        self.semi_implicit_update = zeros(N, Float )
+
+        self.gradients = zeros(N, Float)
+        self.qmax = zeros(self.centroid_values.shape, Float)
+        self.qmin = zeros(self.centroid_values.shape, Float)
+
+        self.beta = domain.beta        
 
     #Methods for operator overloading
@@ -381,33 +401,4 @@
         return integral
 
-class Conserved_quantity(Quantity):
-    """Class conserved quantity adds to Quantity:
-
-    storage and method for updating, and
-    methods for extrapolation from centropid to vertices inluding
-    gradients and limiters
-    """
-
-    def __init__(self, domain, vertex_values=None):
-        Quantity.__init__(self, domain, vertex_values)
-
-        from Numeric import zeros, Float
-        
-        #Allocate space for boundary values
-        #L = len(domain.boundary)
-        self.boundary_values = zeros(2, Float) #assumes no parrellism
-
-        #Allocate space for updates of conserved quantities by
-        #flux calculations and forcing functions
-        
-        N = domain.number_of_elements
-        self.explicit_update = zeros(N, Float )
-        self.semi_implicit_update = zeros(N, Float )
-
-        self.gradients = zeros(N, Float)
-        self.qmax = zeros(self.centroid_values.shape, Float)
-        self.qmin = zeros(self.centroid_values.shape, Float)
-
-        self.beta = domain.beta
 
     def update(self, timestep):
@@ -863,4 +854,19 @@
                 else:
                     qv[k,i] = qc[k]
+    
+
+class Conserved_quantity(Quantity):
+    """Class conserved quantity adds to Quantity:
+
+    storage and method for updating, and
+    methods for extrapolation from centropid to vertices inluding
+    gradients and limiters
+    """
+
+    def __init__(self, domain, vertex_values=None):
+        Quantity.__init__(self, domain, vertex_values)
+
+        print "Use Quantity instead of Conserved_quantity"
+
                     
 
