END\n\ 2 ?? ??\n\ 10.0 80.0\n\ 10.0 90.0\n\ 20.0 90.0\n\ 10.0 80.0\n\ END\n\ END\n") file.close() # import the ungenerate file m.import_ungenerate_file(fileName) os.remove(fileName) m.generate_mesh(maximum_triangle_area=max_area,verbose=False) mesh_filename = "mesh.tsh" m.export_mesh_file(mesh_filename) # Run a simulation on the mesh domain = Domain(mesh_filename, use_cache = False) Br = Reflective_boundary(domain) Bd = Dirichlet_boundary([3,0,0]) domain.set_boundary( {'wall': Br, 'wave': Bd} ) yieldstep = 0.1 finaltime = 20 for t in domain.evolve(yieldstep, finaltime): domain.write_time()
# ######################################################### ############################################## # Change min_depth and see how larger values aggravate the problem yieldstep = 0.1 finaltime = 10.0 #min_depth = 1.0e-4 min_depth = 1.0e-2 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular from anuga.shallow_water import Domain, Reflective_boundary #Create shallow water domain points, vertices, boundary = rectangular(50, 50, len1=500, len2=500) domain = Domain(points, vertices, boundary) domain.smooth = False domain.visualise = True domain.default_order = 1 domain.minimum_allowed_height = min_depth print 'Extent', domain.get_extent() # Set initial condition class Set_IC: """Set an initial condition with a constant value, for x0<x<x1 """ def __init__(self, x0=0.25, x1=0.5, h=1.0): self.x0 = x0 self.x1 = x1 self.h = h
""" # Module imports from anuga.shallow_water import Domain from anuga.shallow_water import Reflective_boundary from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary from anuga.abstract_2d_finite_volumes.util import file_function from anuga_parallel.parallel_api import myid, numprocs, distribute import project #------------------------- # Create Domain from mesh #------------------------- domain = Domain(project.mesh_filename, use_cache=True, verbose=True) print domain.statistics() #------------------------- # Initial Conditions #------------------------- domain.set_quantity('friction', 0.0) domain.set_quantity('stage', 0.0) import time t0 = time.time() bathymetry_filename = project.bathymetry_filename bathymetry_filename = 'Benchmark_2_Bathymetry_very_thin.pts' print 'Starting domain.set_quantity. Loading ', bathymetry_filename s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=True)"