Changeset 7808


Ignore:
Timestamp:
Jun 8, 2010, 10:47:10 AM (14 years ago)
Author:
hudson
Message:

Examples work with new API.

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  
    1414# Import necessary modules
    1515#------------------------------------------------------------------------------
    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
     16import anuga
    2317
    2418waveheight = 1.0
     
    4135meshname = 'harbour_test.msh'
    4236
    43 create_mesh_from_regions(polygon,
     37anuga.create_mesh_from_regions(polygon,
    4438                         boundary_tags={'top': [0],
    4539                                        'left': [1],
     
    5044                         #interior_regions=interior_regions)
    5145
    52 domain = Domain(meshname,use_cache=True,verbose = True)
     46domain = anuga.Domain(meshname,use_cache=True,verbose = True)
    5347domain.set_name('harbour')                  # Output to harbour.sww
    5448domain.set_datadir('.')                     # Use current directory for output
     
    6559
    6660def topography(x,y):
    67     from Numeric import zeros, Float
    68     z = zeros(len(x), Float)
     61    from numpy import zeros, float
     62    z = zeros(len(x), float)
    6963   
    7064    xcentre = (west+east)/2.
     
    9286
    9387from math import sin, pi
    94 Br = Reflective_boundary(domain)      # Solid reflective wall
    95 Bt = Transmissive_boundary(domain)    # Continue all values on boundary
    96 Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
    97 Bw = Time_boundary(domain=domain,     # Time dependent boundary 
     88Br = anuga.Reflective_boundary(domain)      # Solid reflective wall
     89Bt = anuga.Transmissive_boundary(domain)    # Continue all values on boundary
     90Bd = anuga.Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
     91Bw = anuga.Time_boundary(domain=domain,     # Time dependent boundary 
    9892                   f=lambda t: [((10<t<20)*waveheight), 0.0, 0.0])
    9993
     
    115109# Gauge line
    116110def gauge_line(west,east,north,south):
    117     from Numeric import arange
     111    from numpy import arange
    118112    gaugex = arange(east,west,-1000.)
    119113    gauges = []
     
    127121gauges, gaugex, gaugey = gauge_line(west,east,north,south)
    128122
    129 from anuga.abstract_2d_finite_volumes.util import file_function
    130 
    131 f = file_function('harbour.sww',
     123f = anuga.file_function('harbour.sww',
    132124                  quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'],
    133125                  interpolation_points = gauges,
  • trunk/anuga_core/documentation/user_manual/examples/project.py

    r3944 r7808  
    5656demopoly = [j0, j1, j2, j3, j31, j4, j5, j6, j7]
    5757
    58 from anuga.utilities.polygon import read_polygon, plot_polygons
     58from anuga.geometry.polygon import read_polygon, plot_polygons
    5959#polygonptsfile4 = polygondir + 'poly1'
    6060#polygonptsfile0 = polygondir + 'poly2'
  • trunk/anuga_core/documentation/user_manual/examples/runsydney.py

    r3944 r7808  
    2020
    2121# 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
     22import anuga
    2623
    2724# Application specific imports
    2825import project                           # Define file names and polygons
    29 from anuga.shallow_water.smf import slump_tsunami # Function for submarine mudslide
    3026
    3127
     
    4137meshname = project.meshname+'.msh'
    4238
    43 convert_dem_from_ascii2netcdf(demname, use_cache=True, verbose=True)
     39anuga.asc2dem(demname, use_cache=True, verbose=True)
    4440
    4541# 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 
     42anuga.dem2pts(demname, use_cache=True, verbose=True)
    5343
    5444
     
    6858                    [project.shallow_polygon, shallow_res]]
    6959
    70 create_mesh_from_regions(project.demopoly,
     60anuga.create_mesh_from_regions(project.demopoly,
    7161                         boundary_tags= {'oceannorth': [0],
    7262                                         'onshorenorth1': [1],
     
    8575#Create shallow water domain
    8676
    87 domain = Domain(meshname,
     77domain = anuga.Domain(meshname,
    8878                use_cache = True,
    8979                verbose = True)                                 
     
    10292#------------------------------------------------------------------------------
    10393
    104 tsunami_source = slump_tsunami(length=30000.0,
     94tsunami_source = anuga.slump_tsunami(length=30000.0,
    10595                               depth=400.0,
    10696                               slope=6.0,
     
    131121print 'Available boundary tags', domain.get_boundary_tags()
    132122
    133 Bd = Dirichlet_boundary([0.0,0.0,0.0])
     123Bd = anuga.Dirichlet_boundary([0.0,0.0,0.0])
    134124domain.set_boundary( {'oceannorth': Bd,
    135125                      'onshorenorth1': Bd,
  • trunk/anuga_core/documentation/user_manual/examples/runuptest.py

    r3563 r7808  
    1010#------------------------------------------------------------------------------
    1111
    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
     12import anuga
    1813
    1914
     
    3227meshname = 'test.msh'
    3328
    34 create_mesh_from_regions(polygon,
     29anuga.create_mesh_from_regions(polygon,
    3530                         boundary_tags={'top': [0],
    3631                                        'left': [1],
     
    4136                         #interior_regions=interior_regions)
    4237
    43 domain = Domain(meshname,use_cache=True,verbose = True)
     38domain = anuga.Domain(meshname,use_cache=True,verbose = True)
    4439domain.set_name('test')                     # Output to test.sww
    4540domain.set_datadir('.')                     # Use current directory for output
     
    6762
    6863from math import sin, pi
    69 Br = Reflective_boundary(domain)      # Solid reflective wall
    70 Bt = Transmissive_boundary(domain)    # Continue all values on boundary
    71 Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
    72 Bw = Time_boundary(domain=domain,     # Time dependent boundary 
     64Br = anuga.Reflective_boundary(domain)      # Solid reflective wall
     65Bt = anuga.Transmissive_boundary(domain)    # Continue all values on boundary
     66Bd = anuga.Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
     67Bw = anuga.Time_boundary(domain=domain,     # Time dependent boundary 
    7368                   f=lambda t: [((10<t<20)*waveheight), 0.0, 0.0])
    7469
     
    9186# Gauge line
    9287def gauge_line(west,east,north,south):
    93     from Numeric import arange
     88    from numpy import arange
    9489    gaugex = arange(west,(west+east)/2.,1000.)
    9590    gauges = []
     
    10398gauges, gaugex, gaugey = gauge_line(west,east,north,south)
    10499
    105 from anuga.abstract_2d_finite_volumes.util import file_function
    106 
    107 f = file_function('test.sww',
     100f = anuga.file_function('test.sww',
    108101                  quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'],
    109102                  interpolation_points = gauges,
Note: See TracChangeset for help on using the changeset viewer.