Changeset 5918


Ignore:
Timestamp:
Nov 6, 2008, 5:18:31 PM (15 years ago)
Author:
rwilson
Message:

NumPy? conversion.

Location:
anuga_core/source_numpy_conversion/anuga/culvert_flows
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source_numpy_conversion/anuga/culvert_flows/Test_Culvert_Flat_Water_Lev.py

    r5868 r5918  
    2525     
    2626from math import pi,pow,sqrt
    27 from Numeric import choose, greater, ones, sin, exp, cosh
     27import numpy
     28
     29
    2830#------------------------------------------------------------------------------
    2931# Setup computational domain
     
    149151Br = Reflective_boundary(domain)              # Solid reflective wall
    150152Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
    151 Btus = Time_boundary(domain, lambda t: [0.0+ 1.25*(1+sin(2*pi*(t-4)/10)), 0.0, 0.0])
    152 Btds = Time_boundary(domain, lambda t: [0.0+ 0.75*(1+sin(2*pi*(t-4)/20)), 0.0, 0.0])
     153Btus = Time_boundary(domain, lambda t: [0.0+ 1.25*(1+numpy.sin(2*pi*(t-4)/10)), 0.0, 0.0])
     154Btds = Time_boundary(domain, lambda t: [0.0+ 0.75*(1+numpy.sin(2*pi*(t-4)/20)), 0.0, 0.0])
    153155domain.set_boundary({'left': Btus, 'right': Btds, 'top': Br, 'bottom': Br})
    154156
  • anuga_core/source_numpy_conversion/anuga/culvert_flows/culvert_class.py

    r5777 r5918  
    55from anuga.utilities.polygon import is_inside_polygon
    66from anuga.utilities.polygon import plot_polygons
    7 
    87
    98
     
    6665                 verbose=False):
    6766       
    68         from Numeric import sqrt, sum
    69 
    7067        # Input check
    7168        if diameter is not None:
     
    236233       
    237234        from anuga.config import g, epsilon
    238         from Numeric import take, sqrt
    239235        from anuga.config import velocity_protection       
    240236
  • anuga_core/source_numpy_conversion/anuga/culvert_flows/culvert_polygons.py

    r5585 r5918  
    44# Import necessary modules
    55from math import sqrt
    6 from Numeric import array, sum
     6import numpy
     7
    78
    89def create_culvert_polygons(end_point0,
     
    5455    dy = y1-y0
    5556
    56     vector = array([dx, dy])
    57     length = sqrt(sum(vector**2))
     57    vector = numpy.array([dx, dy])
     58    length = sqrt(numpy.sum(vector**2))
    5859
    5960    # Adjust polygon width to number of barrels in this culvert
     
    6364    # Unit direction vector and normal
    6465    vector /= length
    65     normal = array([-dy, dx])/length
     66    normal = numpy.array([-dy, dx])/length
    6667   
    6768
     
    7677    p2 = p1 - h
    7778    p3 = p0 - h
    78     culvert_polygons['exchange_polygon0'] = array([p0,p1,p2,p3])
     79    culvert_polygons['exchange_polygon0'] = numpy.array([p0,p1,p2,p3])
    7980
    8081   
     
    8485    p2 = p1 + h
    8586    p3 = p0 + h
    86     culvert_polygons['exchange_polygon1'] = array([p0,p1,p2,p3])
     87    culvert_polygons['exchange_polygon1'] = numpy.array([p0,p1,p2,p3])
    8788
    8889
     
    9899    p2 = p1 - h
    99100    p3 = p0 - h
    100     culvert_polygons['enquiry_polygon0'] = array([p0,p1,p2,p3])
     101    culvert_polygons['enquiry_polygon0'] = numpy.array([p0,p1,p2,p3])
    101102
    102103    # Build enquiry polygon 1
     
    105106    p2 = p1 + h
    106107    p3 = p0 + h
    107     culvert_polygons['enquiry_polygon1'] = array([p0,p1,p2,p3])   
     108    culvert_polygons['enquiry_polygon1'] = numpy.array([p0,p1,p2,p3])   
    108109
    109110    # Return results
Note: See TracChangeset for help on using the changeset viewer.