source: production/merimbula_2005/run_new_meribula.py @ 2240

Last change on this file since 2240 was 2225, checked in by steve, 19 years ago

Making meribula a production directory

File size: 2.6 KB
Line 
1"""
2Main meribula script using new interface
3"""
4
5#-------------------------------
6# Module imports
7#-------------------------------
8import sys, os
9from pyvolution.shallow_water import Domain, Reflective_boundary,\
10     File_boundary, Transmissive_Momentum_Set_Stage_boundary
11from pyvolution.mesh_factory import rectangular_cross
12from pyvolution.pmesh2domain import pmesh_to_domain_instance
13from Numeric import array, zeros, Float, allclose
14import project
15from caching import cache
16
17
18
19
20#-------------------------------
21# Domain
22#-------------------------------
23print 'Creating domain from', project.mesh_filename
24
25domain = cache(pmesh_to_domain_instance,
26               (project.mesh_filename, Domain),
27               dependencies = [project.mesh_filename])
28
29#domain = pmesh_to_domain_instance(project.mesh_filename, Domain)
30
31domain.check_integrity()
32print 'Number of triangles = ', len(domain)
33print 'The extent is ', domain.get_extent()
34
35
36
37#-------------------------------
38# Initial Conditions
39#-------------------------------
40print 'Initial values'
41
42domain.set_quantity('elevation',
43                    filename = project.bathymetry_filename[:-4] + '.xya',
44                    alpha = 10.0,
45                    verbose = True,
46                    use_cache = True)
47
48domain.set_quantity('friction', 0.03)
49domain.set_quantity('stage', 0.0)
50
51#-------------------------------
52# Boundary conditions
53#-------------------------------
54print 'Boundaries'
55
56#   Tidal cycle recorded at Eden as open
57print 'Open sea boundary condition from ',project.boundary_filename
58from pyvolution.util import file_function
59tide_function = file_function(project.boundary_filename[:-4] + '.tms', domain,
60                         verbose = True)
61Bts = Transmissive_Momentum_Set_Stage_boundary(domain, tide_function)
62
63#   All other boundaries are reflective
64Br = Reflective_boundary(domain)
65
66domain.set_boundary({'exterior': Br, 'open': Bts})
67
68#-------------------------------
69# Setup domain runtime parameters
70#-------------------------------
71domain.visualise = True
72domain.visualise_color_stage = True
73
74base = os.path.basename(sys.argv[0])
75domain.filename, _ = os.path.splitext(base)
76domain.default_order = 2
77domain.store = True    #Store for visualisation purposes
78
79
80
81#-------------------------------
82# Evolve
83#-------------------------------
84import time
85t0 = time.time()
86yieldstep = 60
87finaltime = 3600*24
88
89
90for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
91    domain.write_time()
92
93print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.