Changeset 7838


Ignore:
Timestamp:
Jun 15, 2010, 9:11:59 AM (14 years ago)
Author:
hudson
Message:

Got all demos running with new API.

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  
    2626length = 50
    2727width = 10
    28 resolution = 0.15 # make this number smaller to make the simulation more accurate
     28resolution = 1.0 # make this number smaller to make the simulation more accurate
    2929
    3030# Create the "world" as a long, skinny channel
     
    7373                    })
    7474
     75import cPickle
     76
    7577#------------------------------------------------------------------------------
    7678# Evolve system through time
    7779#------------------------------------------------------------------------------
    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 
     85domain = cPickle.load(open('domain_pickle.txt'))
     86
    8087   
    8188# now turn off the tap
    8289domain.set_boundary({'left': Bo})
    8390
    84 for t in domain.evolve(yieldstep=0.2, finaltime=30.0):
     91for t in domain.evolve(yieldstep=0.1, finaltime=30.0):
    8592    print domain.timestepping_statistics()       
  • trunk/anuga_core/documentation/user_manual/demos/cairns/ExportResults.py

    r7064 r7838  
    33import project
    44
    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
     5import anuga
    86
    97scenario = 'slide'
    10 
    11 name = scenario + sep + scenario + 'source'
     8name = 'cairns_' + scenario
    129
    1310print 'output dir:', name
     
    3633print 'start sww2dem'
    3734
    38 sww2dem(name,
    39         basename_out=outname,
     35anuga.sww2dem(name+'.sww',
     36        outname+'.ers',
    4037        quantity=quantityname,
    4138        cellsize=100,     
     
    4542        northing_max=project.northingmax,       
    4643        reduction=max,
    47         verbose=True,
    48         format='ers')
     44        verbose=True)
  • trunk/anuga_core/documentation/user_manual/demos/cairns/GetTimeseries.py

    r7064 r7838  
    1111from os import sep
    1212import project
    13 from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges,csv2timeseries_graphs
     13import anuga
    1414
    15 sww2csv_gauges('slide'+sep+'slidesource.sww',
     15anuga.sww2csv_gauges('cairns_slide.sww',
    1616                project.gauge_filename,
    1717                quantities=['stage','speed','depth','elevation'],
    1818                verbose=True)
    1919               
    20 sww2csv_gauges('fixed_wave'+sep+'fixed_wavesource.sww',
     20anuga.sww2csv_gauges('cairns_fixed_wave.sww',
    2121               project.gauge_filename,
    2222               quantities=['stage', 'speed','depth','elevation'],
     
    2525try:
    2626    import pylab
    27     csv2timeseries_graphs(directories_dic={'slide'+sep: ['Slide',0, 0],
     27    anuga.csv2timeseries_graphs(directories_dic={'slide'+sep: ['Slide',0, 0],
    2828                                           'fixed_wave'+sep: ['Fixed Wave',0,0]},
    2929                          output_dir='fixed_wave'+sep,
  • trunk/anuga_core/documentation/user_manual/demos/cairns/project.py

    r7816 r7838  
    33"""
    44
    5 from anuga.geometry.polygon import read_polygon, plot_polygons, \
    6                                     polygon_area, is_inside_polygon
     5import anuga
    76
    87#------------------------------------------------------------------------------
    98# Define scenario as either slide or fixed_wave. Choose one.
    109#------------------------------------------------------------------------------
    11 #scenario = 'fixed_wave' # Huge wave applied at the boundary
    12 scenario = 'slide'       # Slide wave form applied inside the domain
     10scenario = 'fixed_wave' # Huge wave applied at the boundary
     11#scenario = 'slide'       # Slide wave form applied inside the domain
    1312
    1413#------------------------------------------------------------------------------
    1514# Filenames
    1615#------------------------------------------------------------------------------
    17 demname_stem = 'cairns'
    18 meshname = demname + '.msh'
     16name_stem = 'cairns'
     17meshname = name_stem + '.msh'
    1918
    2019# Filename for locations where timeseries are to be produced
     
    2524#------------------------------------------------------------------------------
    2625# bounding polygon for study area
    27 bounding_polygon = read_polygon('extent.csv')
     26bounding_polygon = anuga.read_polygon('extent.csv')
    2827
    29 A = polygon_area(bounding_polygon) / 1000000.0
     28A = anuga.polygon_area(bounding_polygon) / 1000000.0
    3029print 'Area of bounding polygon = %.2f km^2' % A
    3130
     
    3433#------------------------------------------------------------------------------
    3534# 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')
     35poly_cairns = anuga.read_polygon('cairns.csv')
     36poly_island0 = anuga.read_polygon('islands.csv')
     37poly_island1 = anuga.read_polygon('islands1.csv')
     38poly_island2 = anuga.read_polygon('islands2.csv')
     39poly_island3 = anuga.read_polygon('islands3.csv')
     40poly_shallow = anuga.read_polygon('shallow.csv')
    4241
    4342# Optionally plot points making up these polygons
  • trunk/anuga_core/documentation/user_manual/demos/cairns/runcairns.py

    r7816 r7838  
    3131#------------------------------------------------------------------------------
    3232# Create DEM from asc data
    33 anuga.asc2dem(project.demname_stem+'.asc', use_cache=True, verbose=True)
     33anuga.asc2dem(project.name_stem+'.asc', use_cache=True, verbose=True)
    3434
    3535# Create pts file for onshore DEM
    36 anuga.dem2pts(project.demname_stem+'.dem', use_cache=True, verbose=True)
     36anuga.dem2pts(project.name_stem+'.dem', use_cache=True, verbose=True)
    3737
    3838#------------------------------------------------------------------------------
     
    7171domain.set_quantity('friction', 0.0)
    7272domain.set_quantity('elevation',
    73                     filename=project.demname + '.pts',
     73                    filename=project.name_stem + '.pts',
    7474                    use_cache=True,
    7575                    verbose=True,
  • trunk/anuga_core/documentation/user_manual/demos/channel1.py

    r7770 r7838  
    1111import anuga
    1212
    13 # Import rectangular cross mesh generator
    14 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
    15 
    1613
    1714#------------------------------------------------------------------------------
    1815# Setup computational domain
    1916#------------------------------------------------------------------------------
    20 points, vertices, boundary = rectangular_cross(10, 5,
     17points, vertices, boundary = anuga.rectangular_cross(10, 5,
    2118                                               len1=10.0, len2=5.0) # Mesh
    2219
  • trunk/anuga_core/documentation/user_manual/demos/runup.py

    r7086 r7838  
    88# Import necessary modules
    99#------------------------------------------------------------------------------
    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
     10import anuga
    1611
    1712from math import sin, pi, exp
     
    2015# Setup computational domain
    2116#------------------------------------------------------------------------------
    22 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
     17points, vertices, boundary = anuga.rectangular_cross(10, 10) # Basic mesh
    2318
    24 domain = Domain(points, vertices, boundary) # Create domain
    25 domain.set_name('runup')                    # Output to file runup.sww
    26 domain.set_datadir('.')                     # Use current directory for output
     19domain = anuga.Domain(points, vertices, boundary)  # Create domain
     20domain.set_name('runup')                            # Output to file runup.sww
     21domain.set_datadir('.')                             # Use current folder
    2722
    2823#------------------------------------------------------------------------------
     
    4035# Setup boundary conditions
    4136#------------------------------------------------------------------------------
    42 Br = Reflective_boundary(domain)      # Solid reflective wall
    43 Bt = Transmissive_boundary(domain)    # Continue all values on boundary
    44 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
    45 Bw = Time_boundary(domain=domain,     # Time dependent boundary 
     37Br = anuga.Reflective_boundary(domain)      # Solid reflective wall
     38Bt = anuga.Transmissive_boundary(domain)    # Continue all values on boundary
     39Bd = anuga.Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
     40Bw = anuga.Time_boundary(domain=domain,     # Time dependent boundary 
    4641                   f=lambda t: [(0.1*sin(t*2*pi)-0.3)*exp(-t), 0.0, 0.0])
    4742
Note: See TracChangeset for help on using the changeset viewer.