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

Examples work with new API.

File:
1 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,
Note: See TracChangeset for help on using the changeset viewer.