Changeset 7808
- Timestamp:
- Jun 8, 2010, 10:47:10 AM (15 years ago)
- Location:
- trunk/anuga_core/documentation/user_manual/examples
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/documentation/user_manual/examples/harbour.py
r3563 r7808 14 14 # Import necessary modules 15 15 #------------------------------------------------------------------------------ 16 17 from anuga.pmesh.mesh_interface import create_mesh_from_regions 18 from anuga.shallow_water import Domain 19 from anuga.shallow_water import Reflective_boundary 20 from anuga.shallow_water import Dirichlet_boundary 21 from anuga.shallow_water import Time_boundary 22 from anuga.shallow_water import Transmissive_boundary 16 import anuga 23 17 24 18 waveheight = 1.0 … … 41 35 meshname = 'harbour_test.msh' 42 36 43 create_mesh_from_regions(polygon,37 anuga.create_mesh_from_regions(polygon, 44 38 boundary_tags={'top': [0], 45 39 'left': [1], … … 50 44 #interior_regions=interior_regions) 51 45 52 domain = Domain(meshname,use_cache=True,verbose = True)46 domain = anuga.Domain(meshname,use_cache=True,verbose = True) 53 47 domain.set_name('harbour') # Output to harbour.sww 54 48 domain.set_datadir('.') # Use current directory for output … … 65 59 66 60 def topography(x,y): 67 from Numeric import zeros, Float68 z = zeros(len(x), Float)61 from numpy import zeros, float 62 z = zeros(len(x), float) 69 63 70 64 xcentre = (west+east)/2. … … 92 86 93 87 from math import sin, pi 94 Br = Reflective_boundary(domain) # Solid reflective wall95 Bt = Transmissive_boundary(domain) # Continue all values on boundary96 Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values97 Bw = Time_boundary(domain=domain, # Time dependent boundary88 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 89 Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary 90 Bd = anuga.Dirichlet_boundary([0.,0.,0.]) # Constant boundary values 91 Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary 98 92 f=lambda t: [((10<t<20)*waveheight), 0.0, 0.0]) 99 93 … … 115 109 # Gauge line 116 110 def gauge_line(west,east,north,south): 117 from Numericimport arange111 from numpy import arange 118 112 gaugex = arange(east,west,-1000.) 119 113 gauges = [] … … 127 121 gauges, gaugex, gaugey = gauge_line(west,east,north,south) 128 122 129 from anuga.abstract_2d_finite_volumes.util import file_function 130 131 f = file_function('harbour.sww', 123 f = anuga.file_function('harbour.sww', 132 124 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'], 133 125 interpolation_points = gauges, -
trunk/anuga_core/documentation/user_manual/examples/project.py
r3944 r7808 56 56 demopoly = [j0, j1, j2, j3, j31, j4, j5, j6, j7] 57 57 58 from anuga. utilities.polygon import read_polygon, plot_polygons58 from anuga.geometry.polygon import read_polygon, plot_polygons 59 59 #polygonptsfile4 = polygondir + 'poly1' 60 60 #polygonptsfile0 = polygondir + 'poly2' -
trunk/anuga_core/documentation/user_manual/examples/runsydney.py
r3944 r7808 20 20 21 21 # Related major packages 22 from anuga.shallow_water import Domain, Dirichlet_boundary 23 from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts 24 from anuga.abstract_2d_finite_volumes.combine_pts import combine_rectangular_points_files 25 from anuga.pmesh.mesh_interface import create_mesh_from_regions 22 import anuga 26 23 27 24 # Application specific imports 28 25 import project # Define file names and polygons 29 from anuga.shallow_water.smf import slump_tsunami # Function for submarine mudslide30 26 31 27 … … 41 37 meshname = project.meshname+'.msh' 42 38 43 convert_dem_from_ascii2netcdf(demname, use_cache=True, verbose=True)39 anuga.asc2dem(demname, use_cache=True, verbose=True) 44 40 45 41 # creates pts file 46 dem2pts(demname, use_cache=True, verbose=True) 47 48 # combining the coarse and fine data 49 #combine_rectangular_points_files(finedemname, 50 # coarsedemname, 51 # combineddemname) 52 42 anuga.dem2pts(demname, use_cache=True, verbose=True) 53 43 54 44 … … 68 58 [project.shallow_polygon, shallow_res]] 69 59 70 create_mesh_from_regions(project.demopoly,60 anuga.create_mesh_from_regions(project.demopoly, 71 61 boundary_tags= {'oceannorth': [0], 72 62 'onshorenorth1': [1], … … 85 75 #Create shallow water domain 86 76 87 domain = Domain(meshname,77 domain = anuga.Domain(meshname, 88 78 use_cache = True, 89 79 verbose = True) … … 102 92 #------------------------------------------------------------------------------ 103 93 104 tsunami_source = slump_tsunami(length=30000.0,94 tsunami_source = anuga.slump_tsunami(length=30000.0, 105 95 depth=400.0, 106 96 slope=6.0, … … 131 121 print 'Available boundary tags', domain.get_boundary_tags() 132 122 133 Bd = Dirichlet_boundary([0.0,0.0,0.0])123 Bd = anuga.Dirichlet_boundary([0.0,0.0,0.0]) 134 124 domain.set_boundary( {'oceannorth': Bd, 135 125 'onshorenorth1': Bd, -
trunk/anuga_core/documentation/user_manual/examples/runuptest.py
r3563 r7808 10 10 #------------------------------------------------------------------------------ 11 11 12 from anuga.pmesh.mesh_interface import create_mesh_from_regions 13 from anuga.shallow_water import Domain 14 from anuga.shallow_water import Reflective_boundary 15 from anuga.shallow_water import Dirichlet_boundary 16 from anuga.shallow_water import Time_boundary 17 from anuga.shallow_water import Transmissive_boundary 12 import anuga 18 13 19 14 … … 32 27 meshname = 'test.msh' 33 28 34 create_mesh_from_regions(polygon,29 anuga.create_mesh_from_regions(polygon, 35 30 boundary_tags={'top': [0], 36 31 'left': [1], … … 41 36 #interior_regions=interior_regions) 42 37 43 domain = Domain(meshname,use_cache=True,verbose = True)38 domain = anuga.Domain(meshname,use_cache=True,verbose = True) 44 39 domain.set_name('test') # Output to test.sww 45 40 domain.set_datadir('.') # Use current directory for output … … 67 62 68 63 from math import sin, pi 69 Br = Reflective_boundary(domain) # Solid reflective wall70 Bt = Transmissive_boundary(domain) # Continue all values on boundary71 Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values72 Bw = Time_boundary(domain=domain, # Time dependent boundary64 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 65 Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary 66 Bd = anuga.Dirichlet_boundary([0.,0.,0.]) # Constant boundary values 67 Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary 73 68 f=lambda t: [((10<t<20)*waveheight), 0.0, 0.0]) 74 69 … … 91 86 # Gauge line 92 87 def gauge_line(west,east,north,south): 93 from Numericimport arange88 from numpy import arange 94 89 gaugex = arange(west,(west+east)/2.,1000.) 95 90 gauges = [] … … 103 98 gauges, gaugex, gaugey = gauge_line(west,east,north,south) 104 99 105 from anuga.abstract_2d_finite_volumes.util import file_function 106 107 f = file_function('test.sww', 100 f = anuga.file_function('test.sww', 108 101 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'], 109 102 interpolation_points = gauges,
Note: See TracChangeset
for help on using the changeset viewer.