"""Validation study of Merimbula lake using Pyvolution. Example of shallow water wave equation applied to Malpasset dam break simulation. Copyright 2004 Christopher Zoppou, Stephen Roberts Australian National University """ ############################### # Setup Path and import modules import sys from os import sep, path sys.path.append('..'+sep+'pyvolution') import Numeric from shallow_water import Domain, Reflective_boundary, File_boundary,\ Dirichlet_boundary, Transmissive_boundary from pmesh2domain import pmesh_to_domain_instance from util import Polygon_function, read_polygon ###################### # Domain filename = 'Noca_mesh_1000.tsh' print 'Creating domain from', filename domain = pmesh_to_domain_instance(filename, Domain) print "Number of triangles = ", len(domain) #-------------------- # Order of the scheme domain.default_order = 2 domain.smooth = True #-------------------------- # This is for Visual Python domain.visualise = True #----------------------- #Set boundary conditions tags = {} tags['reflective'] = Reflective_boundary(domain) tags['transmissive'] = Transmissive_boundary(domain) tags['Dirichlet'] = Dirichlet_boundary([2, 0.0, 0.0]) tags['outer contour'] = None tags['inner contour'] = Reflective_boundary(domain) domain.set_boundary(tags) print 'Boundaries set' #--------------------------------------------------------- #Decide which quantities are to be stored at each timestep domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] #----------------- #Initial condition domain.set_quantity('stage', 0.0) #------------------------------------- # Provide file name for storing output domain.store = True domain.format = 'sww' domain.filename = 'Noca_first_order' #---------------------------- # Friction domain.set_quantity('friction', 0.01) yieldstep = 0.1 finaltime = 10 ###################### #Evolution import time t0 = time.time() for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): domain.write_time() domain.visualiser.update_quantity_color('friction',(1.0,0.0,0.0)) print 'That took %.2f seconds' %(time.time()-t0)