source: anuga_validation/analytical solutions/Analytical_solution_contracting_channel_import_mesh.py @ 3568

Last change on this file since 3568 was 3514, checked in by duncan, 18 years ago

Hi all,
I'm doing a change in the anuga structure, moving the code to

\anuga_core\source\anuga

After you have done an svn update, the PYTHONPATH has to be changed to;
PYTHONPATH = anuga_core/source/

This is part of changes required to make installation of anuga quicker and reducing the size of our sandpits.

If any imports are broken, try fixing them. With adding anuga. to them for example. If this seems to have really broken things, email/phone me.

Cheers
Duncan

File size: 2.3 KB
Line 
1"""Example of shallow water wave equation analytical solution
2consists of a symmetrical converging frictionless channel.
3
4Specific methods pertaining to the 2D shallow water equation
5are imported from shallow_water
6for use with the generic finite volume framework
7
8   Copyright 2005
9   Christopher Zoppou, Stephen Roberts
10   ANU
11   
12Specific methods pertaining to the 2D shallow water equation
13are imported from shallow_water
14for use with the generic finite volume framework
15
16Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the
17numerical vector named conserved_quantities.
18"""
19
20#---------------
21# Module imports
22import sys
23from os import sep
24sys.path.append('..'+sep+'pyvolution')
25
26from shallow_water import Transmissive_boundary, Reflective_boundary, \
27     Dirichlet_boundary
28from shallow_water import Constant_height, Domain
29from pmesh2domain import pmesh_to_domain_instance
30
31#-------
32# Domain
33filename = 'converging_channel_30846.tsh'
34print 'Creating domain from', filename
35domain = pmesh_to_domain_instance(filename, Domain)
36print 'Number of triangles = ', len(domain)
37
38#----------------
39# Order of scheme
40domain.default_order = 2
41domain.smooth = True
42
43#-------------------------------------
44# Provide file name for storing output
45domain.store = True     #Store for visualisation purposes
46domain.format = 'sww'   #Native netcdf visualisation format
47domain.filename = 'contracting_channel_second-order'
48
49#----------------------------------------------------------
50# Decide which quantities are to be stored at each timestep
51domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
52
53#------------------------------------------
54# Reduction operation for get_vertex_values             
55#from anuga.pyvolution.util import mean
56#domain.reduction = mean
57
58#------------------------
59# Set boundary Conditions
60tags = {}
61tags['upstream'] = Dirichlet_boundary([0.2, 1.2, 0.0])
62tags['reflective'] = Reflective_boundary(domain) 
63tags['transmissive'] = Transmissive_boundary(domain)
64domain.set_boundary(tags)
65
66#----------------------
67# Set initial condition
68domain.set_quantity('elevation', 0.0)
69domain.set_quantity('stage', 0.2)
70   
71#----------
72# Evolution
73import time
74t0 = time.time()
75for t in domain.evolve(yieldstep = 0.1, finaltime = .2):
76    domain.write_time()
77   
78print 'That took %.2f seconds' %(time.time()-t0)
79
80   
Note: See TracBrowser for help on using the repository browser.