def test_slide_tsunami_domain(self): if anuga_installed: pass else: print 'Note: test_slide_tsunami_domain not tested as ANUGA '\ 'is not installed' return length = 600.0 dep = 150.0 th = 9.0 thk = 15.0 wid = 340.0 kappa = 3.0 kappad = 0.8 x0 = 100000. y0 = x0 from anuga.pmesh.mesh_interface import create_mesh_from_regions polygon = [[0,0],[200000,0],[200000,200000],[0,200000]] create_mesh_from_regions(polygon, {'e0': [0], 'e1': [1], 'e2': [2], 'e3': [3]}, maximum_triangle_area=5000000000, filename='test.msh', verbose = False) domain = Domain('test.msh', use_cache = True, verbose = False) slide = slide_tsunami(length, dep, th, x0, y0, \ wid, thk, kappa, kappad, \ domain=domain,verbose=False) domain.set_quantity('stage', slide) stage = domain.get_quantity('stage') w = stage.get_values() ## check = [[-0.0 -0.0 -0.0], ## [-.189709745 -517.877716 -0.0], ## [-0.0 -0.0 -2.7695931e-08], ## [-0.0 -2.7695931e-08 -1.897097e-01] ## [-0.0 -517.877716 -0.0], ## [-0.0 -0.0 -0.0], ## [-0.0 -0.0 -0.0], ## [-0.0 -0.0 -0.0]] assert num.allclose(num.min(w), -517.877771593) assert num.allclose(num.max(w), 0.0) assert num.allclose(slide.a3D, 518.38797486)
def test_slide_tsunami(self): len = 600.0 dep = 150.0 th = 9.0 thk = 15.0 wid = 340.0 kappa = 3.0 kappad = 0.8 x0 = 100000. slide = slide_tsunami(length=len, depth=dep, slope=th, x0=x0, \ width = wid, thickness=thk, kappa=kappa, kappad=kappad, \ verbose=False) assert num.allclose(slide.a3D, 0.07775819) assert num.allclose(slide.wavelength, 2938.66695708) assert num.allclose(slide.width, 340.0) assert num.allclose(slide.y0, 0.0) assert num.allclose(slide.alpha, 0.0)