[453] | 1 | """Example of shallow water wave equation. |
---|
| 2 | |
---|
| 3 | Comparison of flatbed between mark 2(Grohm) and mark 3 |
---|
| 4 | |
---|
| 5 | """ |
---|
| 6 | |
---|
| 7 | ###################### |
---|
| 8 | # Module imports |
---|
| 9 | # |
---|
| 10 | from mesh_factory import rectangular |
---|
| 11 | from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ |
---|
| 12 | Transmissive_boundary, Constant_height |
---|
| 13 | from Numeric import array |
---|
| 14 | |
---|
| 15 | #Create basic mesh |
---|
[458] | 16 | N = 10 |
---|
[453] | 17 | points, vertices, boundary = rectangular(N, N) |
---|
| 18 | |
---|
| 19 | #Create shallow water domain |
---|
| 20 | domain = Domain(points, vertices, boundary) |
---|
| 21 | |
---|
| 22 | if N < 20: |
---|
| 23 | domain.visualise = True |
---|
| 24 | else: |
---|
| 25 | domain.visualise = False |
---|
| 26 | domain.store = True |
---|
| 27 | domain.format = 'sww' |
---|
| 28 | domain.filename = 'compare_py3' |
---|
| 29 | |
---|
[458] | 30 | #domain.visualise = False |
---|
[453] | 31 | domain.smooth = False |
---|
[458] | 32 | domain.default_order = 1 |
---|
[453] | 33 | |
---|
| 34 | |
---|
| 35 | print 'Field values' |
---|
| 36 | domain.set_quantity('elevation', 0.0) |
---|
[458] | 37 | domain.set_quantity('friction', 1) |
---|
[453] | 38 | |
---|
| 39 | |
---|
| 40 | ###################### |
---|
| 41 | # Boundary conditions |
---|
| 42 | Br = Reflective_boundary(domain) |
---|
| 43 | Bd = Dirichlet_boundary([0.2,0.,0.]) |
---|
| 44 | Bt = Transmissive_boundary(domain) |
---|
| 45 | |
---|
| 46 | domain.set_boundary({'left': Bd, 'right': Bt, 'top': Bt, 'bottom': Bt}) |
---|
| 47 | domain.check_integrity() |
---|
| 48 | |
---|
[458] | 49 | print domain.quantities['elevation'].centroid_values[:4] |
---|
| 50 | print domain.quantities['friction'].centroid_values[:4] |
---|
[453] | 51 | |
---|
| 52 | ###################### |
---|
| 53 | #Evolution |
---|
[458] | 54 | for t in domain.evolve(yieldstep = 0.01, finaltime = 0.5): |
---|
[453] | 55 | domain.write_time() |
---|
[458] | 56 | #print |
---|
| 57 | |
---|
| 58 | #print domain.quantities['level'].centroid_values |
---|
| 59 | #print domain.quantities['xmomentum'].centroid_values |
---|
| 60 | #print domain.quantities['ymomentum'].centroid_values |
---|
| 61 | |
---|
| 62 | #print 'R' |
---|
| 63 | #print domain.quantities['level'].edge_values |
---|
| 64 | |
---|
| 65 | |
---|