[1292] | 1 | """Validation study of Merimbula lake using Pyvolution. |
---|
| 2 | |
---|
| 3 | Copyright 2004 |
---|
| 4 | Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray |
---|
| 5 | Geoscience Australia, ANU |
---|
[1358] | 6 | |
---|
[1292] | 7 | Specific methods pertaining to the 2D shallow water equation |
---|
| 8 | are imported from shallow_water |
---|
| 9 | for use with the generic finite volume framework |
---|
| 10 | |
---|
| 11 | Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the |
---|
| 12 | numerical vector named conserved_quantities. |
---|
| 13 | |
---|
| 14 | Existence of file 'merimbula_interpolated.tsh' is assumed. |
---|
| 15 | """ |
---|
| 16 | |
---|
| 17 | #------------------------------ |
---|
| 18 | # Setup Path and import modules |
---|
| 19 | import sys |
---|
| 20 | from os import sep, path |
---|
| 21 | sys.path.append('..'+sep+'pyvolution') |
---|
| 22 | |
---|
| 23 | from shallow_water import Domain, Reflective_boundary, File_boundary,\ |
---|
| 24 | Dirichlet_boundary, Wind_stress |
---|
| 25 | from pmesh2domain import pmesh_to_domain_instance |
---|
[1351] | 26 | from util import file_function, Polygon_function, read_polygon, inside_polygon |
---|
| 27 | from Numeric import zeros, Float, asarray |
---|
| 28 | from least_squares import Interpolation |
---|
| 29 | import time |
---|
[1292] | 30 | |
---|
| 31 | #------- |
---|
| 32 | # Domain |
---|
[1351] | 33 | filename = 'merimbula_interpolated_bathymetry.tsh' |
---|
| 34 | filename = 'merimbula_10834_bridge_refined_bathymetry.tsh' |
---|
[1358] | 35 | filename = 'merimbula_10785_1.tsh' |
---|
[1292] | 36 | print 'Creating domain from', filename |
---|
| 37 | domain = pmesh_to_domain_instance(filename, Domain) |
---|
| 38 | print "Number of triangles = ", len(domain) |
---|
| 39 | |
---|
| 40 | #------------------------------------------ |
---|
[1358] | 41 | # Reduction operation for get_vertex_values |
---|
[1292] | 42 | from util import mean |
---|
[1358] | 43 | domain.reduction = mean |
---|
[1292] | 44 | |
---|
| 45 | |
---|
[1351] | 46 | domain.set_quantity('friction',0.03) |
---|
[1292] | 47 | #-------------------- |
---|
| 48 | # Boundary conditions |
---|
[1351] | 49 | |
---|
[1292] | 50 | #--------------------------------------- |
---|
| 51 | # Tidal cycle recorded at Eden as open |
---|
| 52 | filename = 'Eden_tide_Sept03.dat' |
---|
| 53 | print 'Open sea boundary condition from ',filename |
---|
| 54 | Bf = File_boundary(filename, domain) |
---|
[1351] | 55 | |
---|
[1292] | 56 | #-------------------------------------- |
---|
| 57 | # All other boundaries are reflective |
---|
| 58 | Br = Reflective_boundary(domain) |
---|
| 59 | domain.set_boundary({'exterior': Br, 'open': Bf}) |
---|
| 60 | |
---|
| 61 | #----------- |
---|
| 62 | # Wind field |
---|
| 63 | # Format is time [DD/MM/YY hh:mm:ss], speed [m/s] direction (degrees) |
---|
| 64 | filename = 'Merimbula_Weather_data_Sept03_m_per_s.dat' |
---|
| 65 | print 'Wind field from ',filename |
---|
| 66 | F = file_function(filename, domain) |
---|
| 67 | domain.forcing_terms.append(Wind_stress(F)) |
---|
| 68 | |
---|
| 69 | #-------------------------------- |
---|
| 70 | # Initial water surface elevation |
---|
[1351] | 71 | domain.set_quantity('stage', -50.0) |
---|
[1358] | 72 | |
---|
[1292] | 73 | #---------------------------------------------------------- |
---|
| 74 | # Decide which quantities are to be stored at each timestep |
---|
| 75 | domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] |
---|
| 76 | |
---|
| 77 | #------------------------------------- |
---|
| 78 | # Provide file name for storing output |
---|
| 79 | domain.store = True #Store for visualisation purposes |
---|
| 80 | domain.format = 'sww' #Native netcdf visualisation format |
---|
[1393] | 81 | from normalDate import ND |
---|
| 82 | domain.filename = 'Merimbula_2003_4days_dry_%s'%ND() |
---|
[1292] | 83 | |
---|
[1393] | 84 | print domain.filename |
---|
| 85 | |
---|
[1292] | 86 | #---------------------- |
---|
| 87 | # Set order of accuracy |
---|
| 88 | domain.default_order = 1 |
---|
| 89 | domain.smooth = True |
---|
[1358] | 90 | print domain.use_inscribed_circle |
---|
[1295] | 91 | |
---|
[1292] | 92 | #--------- |
---|
[1351] | 93 | # Evolution |
---|
| 94 | t0 = time.time() |
---|
[1363] | 95 | domain.visualise = True |
---|
| 96 | yieldstep = 10 |
---|
[1351] | 97 | finaltime = 588000*3 |
---|
[1292] | 98 | for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): |
---|
| 99 | domain.write_time() |
---|
[1358] | 100 | |
---|
| 101 | print 'That took %.2f seconds' %(time.time()-t0) |
---|