# Ensure that the domain definitions make sense

domain.check_integrity()

# Set the inititial conditions

domain.set_quantity('stage', Set_Stage(0.2, 0.4, 1.0))

# Let processor 0 output some timing information

visualise = False
if visualise:
    from anuga.visualiser import RealtimeVisualiser
    vis = RealtimeVisualiser(domain)
    vis.render_quantity_height("stage", zScale=5.0, dynamic=True)
    vis.colour_height_quantity('stage', (0.2, 0.2, 0.8))
    vis.start()
    import time
    time.sleep(2.0)

if myid == 0:
    import time
    t0 = time.time()

for t in domain.evolve(yieldstep=5.0, finaltime=30.0):
    if myid == 0:
        domain.write_time()

    if visualise:
        vis.update()
Br = anuga.Reflective_boundary(domain)      # Solid reflective wall
Bt = anuga.Transmissive_boundary(domain)    # Continue all values on boundary 
Bd = anuga.Dirichlet_boundary([1,0.,0.]) # Constant boundary values

# Associate boundary tags with boundary objects
domain.set_boundary({'left': Bt, 'right': Bt, 'top': Br, 'bottom': Br})


#===============================================================================
vtk_visualiser = True
if vtk_visualiser:
    from anuga.visualiser import RealtimeVisualiser
    vis = RealtimeVisualiser(domain)
    vis.render_quantity_height("height",dynamic=True)
    #vis.render_quantity_height("stage", zScale =1.0, dynamic=True)
    vis.colour_height_quantity('stage', (0.0, 0.0, 1.0))
    vis.start()
#===============================================================================


#------------------------------------------------------------------------------
# Evolve system through time
#------------------------------------------------------------------------------
i = 0
for t in domain.evolve(yieldstep = 0.01, finaltime = 0.25):
    #print domain.timestepping_statistics(track_speeds=True)
    print domain.timestepping_statistics()
    if vtk_visualiser: 
        vis.update()
        fileName = 'stage_%03d' % i + '.vtk'
        i = i+1
# Ensure that the domain definitions make sense

domain.check_integrity()

# Set the inititial conditions

domain.set_quantity('stage', Set_Stage(0.2,0.4,1.0))

# Let processor 0 output some timing information

visualise = False
if visualise:
    from anuga.visualiser import RealtimeVisualiser
    vis = RealtimeVisualiser(domain)
    vis.render_quantity_height("stage", zScale = 5.0, dynamic=True)
    vis.colour_height_quantity('stage', (0.2, 0.2, 0.8))
    vis.start()
    import time
    time.sleep(2.0)
    


if myid == 0:
    import time
    t0 = time.time()

for t in domain.evolve(yieldstep = 5.0, finaltime = 30.0):
    if myid == 0:
        domain.write_time()
        
    if visualise: