source: anuga_core/source/anuga/abstract_2d_finite_volumes/test_ghost.py @ 7519

Last change on this file since 7519 was 7519, checked in by steve, 14 years ago

Have been playing with using a slope limited velocity to calculate
fluxes (hence the addition of evolved_quantities as well as conserved
quantities.

But the commit is to fix a problem Rudy found with sww2dem. Seems
numpy.array2string is a little too clever, in that it summarizes
output if there is a long sequence of zeros to
[0.0, 0.0, 0.0, ... 0.0, 0.0 ,0.0] To get around this I have added
a call to numpy.set_options(threshold=sys.max_int) to turn this
behaviour off!

File size: 1.2 KB
Line 
1#!/usr/bin/env python
2
3import unittest
4from math import sqrt
5
6from anuga.abstract_2d_finite_volumes.domain import *
7from anuga.config import epsilon
8
9import numpy as num
10
11
12class Test_Domain(unittest.TestCase):
13    def setUp(self):
14        pass
15
16
17    def tearDown(self):
18        pass
19
20
21    def test_simple(self):
22        a = [0.0, 0.0]
23        b = [0.0, 2.0]
24        c = [2.0,0.0]
25        d = [0.0, 4.0]
26        e = [2.0, 2.0]
27        f = [4.0,0.0]
28
29        points = [a, b, c, d, e, f]
30        #bac, bce, ecf, dbe, daf, dae
31        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
32
33        conserved_quantities = ['stage', 'xmomentum', 'ymomentum']
34        other_quantities = ['elevation', 'friction']
35
36        domain = Domain(points, vertices, None,
37                        conserved_quantities, None, other_quantities)
38        domain.check_integrity()
39
40        for name in conserved_quantities + other_quantities:
41            assert domain.quantities.has_key(name)
42
43
44        assert num.alltrue(domain.get_conserved_quantities(0, edge=1) == 0.)
45
46
47#-------------------------------------------------------------
48
49if __name__ == "__main__":
50    suite = unittest.makeSuite(Test_Domain,'test')
51    runner = unittest.TextTestRunner()
52    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.