"""Simple water flow example using ANUGA Water driven up a linear slope and time varying boundary, similar to a beach environment """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ from pmesh.mesh_interface import create_mesh_from_regions from pyvolution.shallow_water import Domain from pyvolution.shallow_water import Reflective_boundary from pyvolution.shallow_water import Dirichlet_boundary from pyvolution.shallow_water import Time_boundary from pyvolution.shallow_water import Transmissive_boundary #------------------------------------------------------------------------------ # Setup computational domain #------------------------------------------------------------------------------ waveheight = 1800.0 depth_east_edge = -4000. timeend = 1000.0 west = 0. east = 80000. south = 0. north = 5000. polygon = [[east,north],[west,north],[west,south],[east,south]] meshname = 'test.msh' create_mesh_from_regions(polygon, boundary_tags={'top': [0], 'left': [1], 'bottom': [2], 'right': [3]}, maximum_triangle_area=200000, filename=meshname) #interior_regions=interior_regions) domain = Domain(meshname,use_cache=True,verbose = True) domain.set_name('test') # Output to test.sww domain.set_datadir('.') # Use current directory for output domain.set_quantities_to_be_stored(['stage',# Store all conserved quantities 'xmomentum', 'ymomentum']) #------------------------------------------------------------------------------ # Setup initial conditions #------------------------------------------------------------------------------ def topography(x,y): slope = depth_east_edge/((east-west)/2.) c = -(west+east)/2.*slope return slope*x+c # linear bed slope domain.set_quantity('elevation', topography) # Use function for elevation domain.set_quantity('friction', 0. ) # Constant friction domain.set_quantity('stage', 0.0) # Constant initial stage #------------------------------------------------------------------------------ # Setup boundary conditions #------------------------------------------------------------------------------ from math import sin, pi Br = Reflective_boundary(domain) # Solid reflective wall Bt = Transmissive_boundary(domain) # Continue all values on boundary Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values Bw = Time_boundary(domain=domain, # Time dependent boundary f=lambda t: [((10