Changeset 7838 for trunk/anuga_core/documentation
- Timestamp:
- Jun 15, 2010, 9:11:59 AM (15 years ago)
- Location:
- trunk/anuga_core/documentation/user_manual/demos
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/documentation/user_manual/demos/buildings.py
r7816 r7838 26 26 length = 50 27 27 width = 10 28 resolution = 0.15# make this number smaller to make the simulation more accurate28 resolution = 1.0 # make this number smaller to make the simulation more accurate 29 29 30 30 # Create the "world" as a long, skinny channel … … 73 73 }) 74 74 75 import cPickle 76 75 77 #------------------------------------------------------------------------------ 76 78 # Evolve system through time 77 79 #------------------------------------------------------------------------------ 78 for t in domain.evolve(yieldstep=0.2, finaltime=15.0): 79 print domain.timestepping_statistics() 80 #for t in domain.evolve(yieldstep=0.2, finaltime=15.0): 81 # print domain.timestepping_statistics() 82 83 #cPickle.dump(domain, open('domain_pickle.txt', 'w')) 84 85 domain = cPickle.load(open('domain_pickle.txt')) 86 80 87 81 88 # now turn off the tap 82 89 domain.set_boundary({'left': Bo}) 83 90 84 for t in domain.evolve(yieldstep=0. 2, finaltime=30.0):91 for t in domain.evolve(yieldstep=0.1, finaltime=30.0): 85 92 print domain.timestepping_statistics() -
trunk/anuga_core/documentation/user_manual/demos/cairns/ExportResults.py
r7064 r7838 3 3 import project 4 4 5 from anuga.shallow_water.data_manager import sww2dem 6 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher 7 from os import sep 5 import anuga 8 6 9 7 scenario = 'slide' 10 11 name = scenario + sep + scenario + 'source' 8 name = 'cairns_' + scenario 12 9 13 10 print 'output dir:', name … … 36 33 print 'start sww2dem' 37 34 38 sww2dem(name,39 basename_out=outname,35 anuga.sww2dem(name+'.sww', 36 outname+'.ers', 40 37 quantity=quantityname, 41 38 cellsize=100, … … 45 42 northing_max=project.northingmax, 46 43 reduction=max, 47 verbose=True, 48 format='ers') 44 verbose=True) -
trunk/anuga_core/documentation/user_manual/demos/cairns/GetTimeseries.py
r7064 r7838 11 11 from os import sep 12 12 import project 13 from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges,csv2timeseries_graphs 13 import anuga 14 14 15 sww2csv_gauges('slide'+sep+'slidesource.sww',15 anuga.sww2csv_gauges('cairns_slide.sww', 16 16 project.gauge_filename, 17 17 quantities=['stage','speed','depth','elevation'], 18 18 verbose=True) 19 19 20 sww2csv_gauges('fixed_wave'+sep+'fixed_wavesource.sww',20 anuga.sww2csv_gauges('cairns_fixed_wave.sww', 21 21 project.gauge_filename, 22 22 quantities=['stage', 'speed','depth','elevation'], … … 25 25 try: 26 26 import pylab 27 csv2timeseries_graphs(directories_dic={'slide'+sep: ['Slide',0, 0],27 anuga.csv2timeseries_graphs(directories_dic={'slide'+sep: ['Slide',0, 0], 28 28 'fixed_wave'+sep: ['Fixed Wave',0,0]}, 29 29 output_dir='fixed_wave'+sep, -
trunk/anuga_core/documentation/user_manual/demos/cairns/project.py
r7816 r7838 3 3 """ 4 4 5 from anuga.geometry.polygon import read_polygon, plot_polygons, \ 6 polygon_area, is_inside_polygon 5 import anuga 7 6 8 7 #------------------------------------------------------------------------------ 9 8 # Define scenario as either slide or fixed_wave. Choose one. 10 9 #------------------------------------------------------------------------------ 11 #scenario = 'fixed_wave' # Huge wave applied at the boundary12 scenario = 'slide' # Slide wave form applied inside the domain10 scenario = 'fixed_wave' # Huge wave applied at the boundary 11 #scenario = 'slide' # Slide wave form applied inside the domain 13 12 14 13 #------------------------------------------------------------------------------ 15 14 # Filenames 16 15 #------------------------------------------------------------------------------ 17 demname_stem = 'cairns'18 meshname = demname+ '.msh'16 name_stem = 'cairns' 17 meshname = name_stem + '.msh' 19 18 20 19 # Filename for locations where timeseries are to be produced … … 25 24 #------------------------------------------------------------------------------ 26 25 # bounding polygon for study area 27 bounding_polygon = read_polygon('extent.csv')26 bounding_polygon = anuga.read_polygon('extent.csv') 28 27 29 A = polygon_area(bounding_polygon) / 1000000.028 A = anuga.polygon_area(bounding_polygon) / 1000000.0 30 29 print 'Area of bounding polygon = %.2f km^2' % A 31 30 … … 34 33 #------------------------------------------------------------------------------ 35 34 # Read interior polygons 36 poly_cairns = read_polygon('cairns.csv')37 poly_island0 = read_polygon('islands.csv')38 poly_island1 = read_polygon('islands1.csv')39 poly_island2 = read_polygon('islands2.csv')40 poly_island3 = read_polygon('islands3.csv')41 poly_shallow = read_polygon('shallow.csv')35 poly_cairns = anuga.read_polygon('cairns.csv') 36 poly_island0 = anuga.read_polygon('islands.csv') 37 poly_island1 = anuga.read_polygon('islands1.csv') 38 poly_island2 = anuga.read_polygon('islands2.csv') 39 poly_island3 = anuga.read_polygon('islands3.csv') 40 poly_shallow = anuga.read_polygon('shallow.csv') 42 41 43 42 # Optionally plot points making up these polygons -
trunk/anuga_core/documentation/user_manual/demos/cairns/runcairns.py
r7816 r7838 31 31 #------------------------------------------------------------------------------ 32 32 # Create DEM from asc data 33 anuga.asc2dem(project. demname_stem+'.asc', use_cache=True, verbose=True)33 anuga.asc2dem(project.name_stem+'.asc', use_cache=True, verbose=True) 34 34 35 35 # Create pts file for onshore DEM 36 anuga.dem2pts(project. demname_stem+'.dem', use_cache=True, verbose=True)36 anuga.dem2pts(project.name_stem+'.dem', use_cache=True, verbose=True) 37 37 38 38 #------------------------------------------------------------------------------ … … 71 71 domain.set_quantity('friction', 0.0) 72 72 domain.set_quantity('elevation', 73 filename=project. demname+ '.pts',73 filename=project.name_stem + '.pts', 74 74 use_cache=True, 75 75 verbose=True, -
trunk/anuga_core/documentation/user_manual/demos/channel1.py
r7770 r7838 11 11 import anuga 12 12 13 # Import rectangular cross mesh generator14 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross15 16 13 17 14 #------------------------------------------------------------------------------ 18 15 # Setup computational domain 19 16 #------------------------------------------------------------------------------ 20 points, vertices, boundary = rectangular_cross(10, 5,17 points, vertices, boundary = anuga.rectangular_cross(10, 5, 21 18 len1=10.0, len2=5.0) # Mesh 22 19 -
trunk/anuga_core/documentation/user_manual/demos/runup.py
r7086 r7838 8 8 # Import necessary modules 9 9 #------------------------------------------------------------------------------ 10 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross 11 from anuga.shallow_water import Domain 12 from anuga.shallow_water import Reflective_boundary 13 from anuga.shallow_water import Dirichlet_boundary 14 from anuga.shallow_water import Time_boundary 15 from anuga.shallow_water import Transmissive_boundary 10 import anuga 16 11 17 12 from math import sin, pi, exp … … 20 15 # Setup computational domain 21 16 #------------------------------------------------------------------------------ 22 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh17 points, vertices, boundary = anuga.rectangular_cross(10, 10) # Basic mesh 23 18 24 domain = Domain(points, vertices, boundary)# Create domain25 domain.set_name('runup') # Output to file runup.sww26 domain.set_datadir('.') # Use current directory for output19 domain = anuga.Domain(points, vertices, boundary) # Create domain 20 domain.set_name('runup') # Output to file runup.sww 21 domain.set_datadir('.') # Use current folder 27 22 28 23 #------------------------------------------------------------------------------ … … 40 35 # Setup boundary conditions 41 36 #------------------------------------------------------------------------------ 42 Br = Reflective_boundary(domain) # Solid reflective wall43 Bt = Transmissive_boundary(domain) # Continue all values on boundary44 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values45 Bw = Time_boundary(domain=domain, # Time dependent boundary37 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 38 Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary 39 Bd = anuga.Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values 40 Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary 46 41 f=lambda t: [(0.1*sin(t*2*pi)-0.3)*exp(-t), 0.0, 0.0]) 47 42
Note: See TracChangeset
for help on using the changeset viewer.