source: trunk/anuga_work/shallow_water_balanced_steve/run_sw_merimbula.py @ 8377

Last change on this file since 8377 was 8377, checked in by steve, 13 years ago

Some changes to allow different compute fluxes

File size: 3.5 KB
Line 
1
2"""Run parallel shallow water domain.
3
4   run using command like:
5
6   python run_sw_merimbula.py
7
8   where m is the number of processors to be used.
9   
10   Will produce sww files with names domain_Pn_m.sww where m is number of processors and
11   n in [0, m-1] refers to specific processor that owned this part of the partitioned mesh.
12"""
13
14#------------------------------------------------------------------------------
15# Import necessary modules
16#------------------------------------------------------------------------------
17
18import os
19import sys
20import time
21import numpy as num
22
23#------------------------
24# ANUGA Modules
25#------------------------
26       
27#from swb_domain import Domain
28
29# Gareth's well balance code
30#from balanced_basic import Domain
31
32from anuga import Domain
33from anuga import Reflective_boundary
34from anuga import Dirichlet_boundary
35from anuga import Time_boundary
36#from swb_domain import Transmissive_boundary
37
38from anuga import rectangular_cross
39from anuga import create_domain_from_file
40
41
42
43#--------------------------------------------------------------------------
44# Setup parameters
45#--------------------------------------------------------------------------
46
47mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0
48#mesh_filename = "merimbula_43200.tsh"   ; x0 = 756000.0 ; x1 = 756500.0
49#mesh_filename = "test-100.tsh" ; x0 = 0.25 ; x1 = 0.5
50#mesh_filename = "test-20.tsh" ; x0 = 250.0 ; x1 = 350.0
51yieldstep = 1 #20
52finaltime = 10 #200
53verbose = True
54
55#--------------------------------------------------------------------------
56# Setup procedures
57#--------------------------------------------------------------------------
58class Set_Stage:
59    """Set an initial condition with constant water height, for x0<x<x1
60    """
61
62    def __init__(self, x0=0.25, x1=0.5, h=1.0):
63        self.x0 = x0
64        self.x1 = x1
65        self.= h
66
67    def __call__(self, x, y):
68        return self.h*((x>self.x0)&(x<self.x1))
69
70
71class Set_Elevation:
72    """Set an elevation
73    """
74
75    def __init__(self, h=1.0):
76        self.x0 = x0
77        self.x1 = x1
78        self.= h
79
80    def __call__(self, x, y):
81        return x/self.h
82   
83
84#--------------------------------------------------------------------------
85# Setup Domain
86#--------------------------------------------------------------------------
87domain = create_domain_from_file(mesh_filename, DomainClass=Domain)
88
89domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
90
91
92#--------------------------------------------------------------------------
93# Setup Domain
94#--------------------------------------------------------------------------
95domain.set_default_order(2)
96domain.set_timestepping_method('rk2')
97#domain.set_CFL(0.7)
98#domain.set_beta(1.5)
99domain.set_name('merimbula')
100
101
102
103#------------------------------------------------------------------------------
104# Setup boundary conditions
105# This must currently happen *after* domain has been distributed
106#------------------------------------------------------------------------------
107Br = Reflective_boundary(domain)      # Solid reflective wall
108
109domain.set_boundary({'outflow' :Br, 'inflow' :Br, 'inner' :Br, 'exterior' :Br, 'open' :Br})
110
111#------------------------------------------------------------------------------
112# Evolution
113#------------------------------------------------------------------------------
114if verbose: print 'EVOLVE'
115
116t0 = time.time()
117
118for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
119    domain.write_time()
120
121print 'That took %.2f seconds' %(time.time()-t0)
122
123
124
Note: See TracBrowser for help on using the repository browser.