source: anuga_work/production/sydney_2006/eq_test.py @ 4344

Last change on this file since 4344 was 4327, checked in by sexton, 18 years ago

eq source stuff

File size: 2.3 KB
Line 
1
2from anuga.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary
3from eqf_v2 import earthquake_tsunami
4
5res = 10000000.
6intres = 1000000.
7boundingpoly=[[-100000,-80000],[-100000,80000],[100000,80000],[100000,-80000]]
8poly = [[-40000,-20000],[40000,-20000],[40000,30000],[-40000,30000]]
9interior_regions = [[poly,intres]]
10
11from anuga.pmesh.mesh_interface import create_mesh_from_regions
12from caching import cache
13meshname = '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
23domain = Domain(meshname, use_cache = True, verbose = True)
24
25basename = 'test'
26domain.set_name(basename)
27domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
28domain.set_minimum_storable_height(0.01)
29
30tsunami_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
41stage0 = 1.0
42#domain.set_quantity('stage', stage0)
43#z1 = domain.get_quantity('stage')
44#int1 = z1.get_integral()/400000.0
45
46domain.set_quantity('stage', tsunami_source)
47z2 = domain.get_quantity('stage')
48int2 = z2.get_integral()/400000.0
49#print 'integral before and after', int1, int2
50
51print len(z2)
52print 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
60domain.set_quantity('elevation', -10.0, alpha = 0.1)
61
62Br = Reflective_boundary(domain)
63Bd = Dirichlet_boundary([0,0,0])
64domain.set_boundary( {'e0': Br,  'e1': Br, 'e2': Br, 'e3': Br} )
65
66import time
67
68t0 = time.time()
69
70for t in domain.evolve(yieldstep = 1, finaltime = 1): 
71    domain.write_time()
72    domain.write_boundary_statistics(tags = 'e2')
73
Note: See TracBrowser for help on using the repository browser.