Line | |
---|
1 | """Simple example using the module for solving the advection equation |
---|
2 | |
---|
3 | Initial condition is zero, boudary conditions are dirichlet at the left edge |
---|
4 | and transmissive everywhere else |
---|
5 | """ |
---|
6 | import sys |
---|
7 | from os import sep |
---|
8 | sys.path.append('..'+sep+'pyvolution') |
---|
9 | |
---|
10 | from mesh_factory import rectangular |
---|
11 | from advection import Domain, Transmissive_boundary, Dirichlet_boundary |
---|
12 | |
---|
13 | from Numeric import array |
---|
14 | |
---|
15 | #Create basic mesh |
---|
16 | points, vertices, boundary = rectangular(8, 8) |
---|
17 | |
---|
18 | #Create advection domain with direction (1,-1) |
---|
19 | # - Initial condition is zero by default |
---|
20 | domain = Domain(points, vertices, boundary, velocity=[1.0, -1.0]) |
---|
21 | domain.smooth = False |
---|
22 | domain.visualise = True |
---|
23 | |
---|
24 | #Boundaries |
---|
25 | T = Transmissive_boundary(domain) |
---|
26 | D = Dirichlet_boundary(array([0.1])) |
---|
27 | |
---|
28 | domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} ) |
---|
29 | domain.check_integrity() |
---|
30 | |
---|
31 | ################### |
---|
32 | # Evolution |
---|
33 | for 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.