source: inundation/ga/storm_surge/examples/advection_dirichlet.py @ 195

Last change on this file since 195 was 195, checked in by ole, 20 years ago
File size: 993 bytes
Line 
1"""Simple example using the module for solving the advection equation
2
3Initial condition is zero, boudary conditions are dirichlet at the left edge
4and transmissive everywhere else
5"""
6import sys
7from os import sep
8sys.path.append('..'+sep+'pyvolution')
9
10from mesh_factory import rectangular
11from advection import Domain, Transmissive_boundary, Dirichlet_boundary
12
13from Numeric import array
14
15#Create basic mesh
16points, vertices, boundary = rectangular(8, 8)
17
18#Create advection domain with direction (1,-1)
19# - Initial condition is zero by default
20domain = Domain(points, vertices, boundary, velocity=[1.0, -1.0])
21domain.smooth = False
22domain.visualise = True
23
24#Boundaries
25T = Transmissive_boundary(domain)
26D = Dirichlet_boundary(array([0.1]))
27
28domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} )
29domain.check_integrity()
30
31###################
32# Evolution
33for t in domain.evolve(yieldstep = 0.02, finaltime = 2):
34    domain.write_time()
35
36
37
Note: See TracBrowser for help on using the repository browser.