Last change
on this file since 3563 was
3563,
checked in by ole, 18 years ago
|
Moved shallow water out from the old pyvolution directory.
All tests pass, most examples and okushiri works again.
|
File size:
1.2 KB
|
Line | |
---|
1 | |
---|
2 | #Run bedslopephysical.py first then this |
---|
3 | # |
---|
4 | #Notice the statistics output |
---|
5 | |
---|
6 | from anuga.abstract_2d_finite_volumes.util import file_function |
---|
7 | |
---|
8 | f = file_function('bedslope.sww', |
---|
9 | quantities = ['stage', #Quantities we want to interpolate |
---|
10 | 'elevation', |
---|
11 | 'xmomentum', |
---|
12 | 'ymomentum'], |
---|
13 | interpolation_points = [ [0.0, 0.0], #Predefined points |
---|
14 | [0.5, 0.5], |
---|
15 | [0.8, 0.7]], |
---|
16 | verbose = True) |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | #Now try to call the function f |
---|
23 | |
---|
24 | #This gives all four quantities at time=1.2 and for predefined point |
---|
25 | #indexed 1 (which is 0.5, 0.5) |
---|
26 | print f(1.2, 1) |
---|
27 | |
---|
28 | |
---|
29 | #To get e.g. xmomentum one may index the output with its number (2) |
---|
30 | print f(1.2, 1)[2] #xmomentum at time=1.2 and for point number 1 |
---|
31 | |
---|
32 | |
---|
33 | #To get a timeseries (arbitrary times within the limits) for stage at point |
---|
34 | #[0.8, 0.7] (index 2) |
---|
35 | |
---|
36 | t = 0.0 |
---|
37 | tmax = 4.0 #From file_function statistics! |
---|
38 | |
---|
39 | print |
---|
40 | print 'Table of interpolated values of stage' |
---|
41 | print 't f(t, 2)[0]' |
---|
42 | while t <= tmax: |
---|
43 | print '%.4f %.4f' %(t, f(t, 2)[0]) |
---|
44 | t += 0.1234 |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.