source: inundation/Hobart/Run_noca.py @ 1743

Last change on this file since 1743 was 1436, checked in by steve, 20 years ago
File size: 2.2 KB
Line 
1"""Validation study of Merimbula lake using Pyvolution.
2Example of shallow water wave equation applied to
3Malpasset dam break simulation.
4
5   Copyright 2004
6   Christopher Zoppou, Stephen Roberts
7   Australian National University
8
9
10"""
11
12###############################
13# Setup Path and import modules
14import sys
15from os import sep, path
16sys.path.append('..'+sep+'pyvolution')
17
18import Numeric
19from shallow_water import Domain, Reflective_boundary, File_boundary,\
20     Dirichlet_boundary, Transmissive_boundary
21from pmesh2domain import pmesh_to_domain_instance
22from util import Polygon_function, read_polygon
23
24######################
25# Domain
26filename = 'Noca_mesh_1000.tsh'
27print 'Creating domain from', filename
28domain = pmesh_to_domain_instance(filename, Domain)
29print "Number of triangles = ", len(domain)
30
31#--------------------
32# Order of the scheme
33domain.default_order = 2
34domain.smooth = True
35
36#--------------------------
37# This is for Visual Python
38domain.visualise = True
39
40#-----------------------
41#Set boundary conditions
42tags = {}
43tags['reflective'] = Reflective_boundary(domain)
44tags['transmissive'] = Transmissive_boundary(domain)
45tags['Dirichlet'] = Dirichlet_boundary([2, 0.0, 0.0])
46tags['outer contour'] = None
47tags['inner contour'] = Reflective_boundary(domain)
48domain.set_boundary(tags)
49print 'Boundaries set'
50
51#---------------------------------------------------------
52#Decide which quantities are to be stored at each timestep
53domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
54
55#-----------------
56#Initial condition
57domain.set_quantity('stage', 0.0)
58
59#-------------------------------------
60# Provide file name for storing output
61domain.store = True
62domain.format = 'sww'
63domain.filename = 'Noca_first_order'
64
65#----------------------------
66# Friction
67domain.set_quantity('friction', 0.01)
68
69yieldstep = 0.1
70finaltime = 10
71
72######################
73#Evolution
74import time
75t0 = time.time()
76for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
77    domain.write_time()
78    domain.visualiser.update_quantity_color('friction',(1.0,0.0,0.0))
79
80print 'That took %.2f seconds' %(time.time()-t0)
81
Note: See TracBrowser for help on using the repository browser.