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

Last change on this file since 8301 was 8301, checked in by steve, 12 years ago

Set parallel_safe = True for rainfall forcing term.

File size: 3.4 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       
27from swb_domain import Domain
28#from anuga import Domain
29from anuga import Reflective_boundary
30from anuga import Dirichlet_boundary
31from anuga import Time_boundary
32#from swb_domain import Transmissive_boundary
33
34from anuga import rectangular_cross
35from anuga import create_domain_from_file
36
37
38
39#--------------------------------------------------------------------------
40# Setup parameters
41#--------------------------------------------------------------------------
42
43mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0
44#mesh_filename = "merimbula_43200.tsh"   ; x0 = 756000.0 ; x1 = 756500.0
45#mesh_filename = "test-100.tsh" ; x0 = 0.25 ; x1 = 0.5
46#mesh_filename = "test-20.tsh" ; x0 = 250.0 ; x1 = 350.0
47yieldstep = 20
48finaltime = 200
49verbose = True
50
51#--------------------------------------------------------------------------
52# Setup procedures
53#--------------------------------------------------------------------------
54class Set_Stage:
55    """Set an initial condition with constant water height, for x0<x<x1
56    """
57
58    def __init__(self, x0=0.25, x1=0.5, h=1.0):
59        self.x0 = x0
60        self.x1 = x1
61        self.= h
62
63    def __call__(self, x, y):
64        return self.h*((x>self.x0)&(x<self.x1))
65
66
67class Set_Elevation:
68    """Set an elevation
69    """
70
71    def __init__(self, h=1.0):
72        self.x0 = x0
73        self.x1 = x1
74        self.= h
75
76    def __call__(self, x, y):
77        return x/self.h
78   
79
80#--------------------------------------------------------------------------
81# Setup Domain
82#--------------------------------------------------------------------------
83domain = create_domain_from_file(mesh_filename, DomainClass=Domain)
84
85domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
86
87
88#--------------------------------------------------------------------------
89# Setup Domain
90#--------------------------------------------------------------------------
91domain.set_default_order(2)
92domain.set_timestepping_method('rk2')
93#domain.set_CFL(0.7)
94#domain.set_beta(1.5)
95domain.set_name('merimbula')
96
97
98
99#------------------------------------------------------------------------------
100# Setup boundary conditions
101# This must currently happen *after* domain has been distributed
102#------------------------------------------------------------------------------
103Br = Reflective_boundary(domain)      # Solid reflective wall
104
105domain.set_boundary({'outflow' :Br, 'inflow' :Br, 'inner' :Br, 'exterior' :Br, 'open' :Br})
106
107#------------------------------------------------------------------------------
108# Evolution
109#------------------------------------------------------------------------------
110if verbose: print 'EVOLVE'
111
112t0 = time.time()
113
114for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
115    domain.write_time()
116
117print 'That took %.2f seconds' %(time.time()-t0)
118
119
120
Note: See TracBrowser for help on using the repository browser.