source: anuga_core/source/anuga/shallow_water/test_smf.py @ 5611

Last change on this file since 5611 was 4560, checked in by duncan, 17 years ago

test all of the tests

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1import unittest
2from Numeric import allclose
3from smf import slide_tsunami, slump_tsunami, Double_gaussian
4
5class Test_smf(unittest.TestCase):
6    def setUp(self):
7        pass
8
9    def tearDown(self):
10        pass
11
12
13    def test_Double_gaussian(self):
14        a3D = 5.6
15        wavelength = 10.2
16        width = 6.6
17        x0 = 0.0
18        y0 = 0.0
19        alpha = 0.0
20        kappa = 3.0
21        kappad = 0.8
22        dx = 0.5
23        zsmall = 0.01
24
25        dg = Double_gaussian(a3D=a3D, wavelength=wavelength, width=width, \
26                             x0=x0, y0=y0, alpha=alpha, dx = dx, \
27                             kappa=kappa, kappad = kappad, zsmall = zsmall)
28
29        assert allclose(dg.a3D, a3D)
30        assert allclose(dg.wavelength, wavelength)
31        assert allclose(dg.width, width)
32        assert allclose(dg.x0, x0)
33        assert allclose(dg.y0, y0)
34        assert allclose(dg.alpha, alpha)
35        assert allclose(dg.kappa, kappa)
36        assert allclose(dg.kappad, kappad)
37        assert allclose(dg.dx, dx)
38
39
40    def test_slide_tsunami(self):
41
42        len = 600.0
43        dep = 150.0
44        th = 9.0
45        thk = 15.0
46        wid = 340.0
47
48        slide = slide_tsunami(length=len, depth=dep, slope=th, \
49                              width = wid, thickness=thk)
50
51        assert allclose(slide.a3D, 0.07775819)
52        assert allclose(slide.wavelength, 2938.66695708)
53        assert allclose(slide.width, 340.0)
54        assert allclose(slide.x0, 0.0)
55        assert allclose(slide.y0, 0.0)
56        assert allclose(slide.alpha, 0.0)
57        assert allclose(slide.kappa, 3.0)
58        assert allclose(slide.kappad, 0.8)
59
60
61    def test_slump_tsunami(self):
62
63        len = 4500.0
64        thk = 760.0
65        wid = 4500.0
66        dep = 1200.0
67        rad = 3330
68        dp = 0.23
69        th = 12
70        alpha = 0.0
71        x0 = 0
72        y0 = 0
73
74        slump = slump_tsunami(length=len, depth=dep, slope=th, thickness=thk,\
75                  radius=rad, dphi=dp, x0=x0, y0=y0, alpha=alpha)
76
77        assert allclose(slump.a3D, 9.82538623)
78        assert allclose(slump.wavelength, 3660.37606554)
79        assert allclose(slump.width, 4500.0)
80        assert allclose(slump.x0, 0.0)
81        assert allclose(slump.y0, 0.0)
82        assert allclose(slump.alpha, 0.0)
83        assert allclose(slump.kappa, 3.0)
84        assert allclose(slump.kappad, 1.0)
85
86
87#-------------------------------------------------------------
88if __name__ == "__main__":
89    #suite = unittest.makeSuite(Test_smf,'test_Double_gaussian')
90    suite = unittest.makeSuite(Test_smf,'test')
91    runner = unittest.TextTestRunner()
92    runner.run(suite)
93
Note: See TracBrowser for help on using the repository browser.