source: trunk/anuga_work/anuga_gpu/mytest.py @ 8383

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

Moved and then moved back anuga_1d. Will have to get Paul Bryan to first
update the pipe flow directory

File size: 1.2 KB
Line 
1import numpy as num
2from gpu_domain  import GPU_domain
3
4"""test flux calculation (actual C implementation)
5
6This one tests the constant case where only the pressure term
7contributes to each edge and cancels out once the total flux has
8been summed up.
9"""
10
11a = [0.0, 0.0]
12b = [0.0, 2.0]
13c = [2.0, 0.0]
14d = [0.0, 4.0]
15e = [2.0, 2.0]
16f = [4.0, 0.0]
17
18points = [a, b, c, d, e, f]
19#              bac,     bce,     ecf,     dbe
20vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
21
22domain = GPU_domain(points, vertices)
23domain.check_integrity()
24
25# The constant case
26domain.set_quantity('elevation', -1)
27domain.set_quantity('stage', 1)
28
29domain.compute_fluxes()
30print "+++ fluxes: done +++"
31domain.compute_fluxes()
32print "+++ fluxes: done +++"
33# Central triangle
34#assert num.allclose(domain.get_quantity('stage').explicit_update[1], 0)
35
36# The more general case
37#def surface(x, y):
38#    return -x/2
39
40#domain.set_quantity('elevation', -10)
41#domain.set_quantity('stage', surface)
42#domain.set_quantity('xmomentum', 1)
43
44#domain.compute_fluxes()
45
46#print domain.get_quantity('stage').explicit_update
47# FIXME (Ole): TODO the general case
48#assert allclose(domain.get_quantity('stage').explicit_update[1], ...??)
Note: See TracBrowser for help on using the repository browser.