1 | |
---|
2 | from anuga.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary |
---|
3 | from eqf_v2 import earthquake_tsunami |
---|
4 | |
---|
5 | res = 10000000. |
---|
6 | intres = 1000000. |
---|
7 | boundingpoly=[[-100000,-80000],[-100000,80000],[100000,80000],[100000,-80000]] |
---|
8 | poly = [[-40000,-20000],[40000,-20000],[40000,30000],[-40000,30000]] |
---|
9 | interior_regions = [[poly,intres]] |
---|
10 | |
---|
11 | from anuga.pmesh.mesh_interface import create_mesh_from_regions |
---|
12 | from caching import cache |
---|
13 | meshname = 'another_test'+'.msh' |
---|
14 | |
---|
15 | _ = cache(create_mesh_from_regions, |
---|
16 | boundingpoly, |
---|
17 | {'boundary_tags': {'e0': [0], 'e1': [1], 'e2': [2], 'e3': [3]}, |
---|
18 | 'maximum_triangle_area': res, |
---|
19 | 'filename': meshname, |
---|
20 | 'interior_regions': interior_regions}, |
---|
21 | verbose = True) |
---|
22 | |
---|
23 | domain = Domain(meshname, use_cache = True, verbose = True) |
---|
24 | |
---|
25 | basename = 'test' |
---|
26 | domain.set_name(basename) |
---|
27 | domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) |
---|
28 | domain.set_minimum_storable_height(0.01) |
---|
29 | |
---|
30 | tsunami_source = earthquake_tsunami(length=25.0, |
---|
31 | width=5., |
---|
32 | strike=0., |
---|
33 | depth=3500.0, |
---|
34 | dip=15.0, |
---|
35 | slip=10., |
---|
36 | x0=0.0, |
---|
37 | y0=0.0, |
---|
38 | domain=domain, |
---|
39 | verbose=True) |
---|
40 | |
---|
41 | stage0 = 1.0 |
---|
42 | #domain.set_quantity('stage', stage0) |
---|
43 | #z1 = domain.get_quantity('stage') |
---|
44 | #int1 = z1.get_integral()/400000.0 |
---|
45 | |
---|
46 | domain.set_quantity('stage', tsunami_source) |
---|
47 | z2 = domain.get_quantity('stage') |
---|
48 | int2 = z2.get_integral()/400000.0 |
---|
49 | #print 'integral before and after', int1, int2 |
---|
50 | |
---|
51 | print len(z2) |
---|
52 | print dir(z2) |
---|
53 | #X,Y,A,V = z2.get_vertex_values() |
---|
54 | #print 'x', V |
---|
55 | |
---|
56 | #print 'values', z.get_values() |
---|
57 | #print 'vertex', z.get_vertex_values() |
---|
58 | #import sys; sys.exit() |
---|
59 | |
---|
60 | domain.set_quantity('elevation', -10.0, alpha = 0.1) |
---|
61 | |
---|
62 | Br = Reflective_boundary(domain) |
---|
63 | Bd = Dirichlet_boundary([0,0,0]) |
---|
64 | domain.set_boundary( {'e0': Br, 'e1': Br, 'e2': Br, 'e3': Br} ) |
---|
65 | |
---|
66 | import time |
---|
67 | |
---|
68 | t0 = time.time() |
---|
69 | |
---|
70 | for t in domain.evolve(yieldstep = 1, finaltime = 1): |
---|
71 | domain.write_time() |
---|
72 | domain.write_boundary_statistics(tags = 'e2') |
---|
73 | |
---|