source: anuga_core/source/anuga/shallow_water/test_eq.py @ 5531

Last change on this file since 5531 was 5180, checked in by steve, 16 years ago

Added an example which has soliton type solutions (tilted.py)

File size: 1.8 KB
Line 
1import unittest
2from Numeric import allclose
3from eqf import earthquake_tsunami, Okada_func
4
5class Test_eq(unittest.TestCase):
6    def setUp(self):
7        pass
8
9    def tearDown(self):
10        pass
11
12
13    def test_Okada_func(self):
14        x0 = 38000.0
15        y0 = 12500.0
16        length = 25.0
17        width = 5.0
18        strike = 0.0
19        depth = 3500.
20        slip = 10.0
21        dip = 15.0
22        rake = 90.0
23        test = -2205.904774487
24
25        #print 'depth', depth
26        z = Okada_func(length=length, width=width, dip=dip, \
27                       x0=x0, y0=y0, strike=strike, depth=depth, \
28                       slip=slip, rake=rake, test=test)
29
30        assert allclose(z.length, length)
31        assert allclose(z.width, width)
32        assert allclose(z.x0, x0)
33        assert allclose(z.y0, y0)
34        assert allclose(z.strike, strike)
35        assert allclose(z.depth, depth)
36        assert allclose(z.slip, slip)
37        assert allclose(z.dip, dip)
38        assert allclose(z.rake, rake)
39
40        #print 'in test', z.test
41        assert allclose(z.test, -2205.904774487)
42       
43        #print 'hello finished okada'
44
45    def test_earthquake_tsunami(self):
46
47        x0 = 0.0
48        y0 = 0.0
49        length = 25.0
50        width = 5.0
51        strike = 0.0
52        depth = 3500.
53        slip = 10.0
54        dip = 15.0
55       
56        eq = earthquake_tsunami(length=length, width = width, depth=depth, \
57                                strike = strike, dip = dip, slip = slip, \
58                                x0 = x0, y0 = y0)
59
60#-------------------------------------------------------------
61if __name__ == "__main__":
62    suite = unittest.makeSuite(Test_eq,'test_Okada_func')
63    #suite = unittest.makeSuite(Test_eq,'test_earthquake_tsunami')
64    runner = unittest.TextTestRunner()
65    runner.run(suite)
66
Note: See TracBrowser for help on using the repository browser.