Changeset 5908
- Timestamp:
- Nov 6, 2008, 4:20:34 PM (16 years ago)
- Location:
- anuga_core/source_numpy_conversion/anuga/advection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source_numpy_conversion/anuga/advection/advection.py
r5847 r5908 20 20 """ 21 21 22 import numpy 22 23 23 24 #import logging, logging.config … … 66 67 numproc=numproc) 67 68 68 import Numeric69 69 if velocity is None: 70 self.velocity = Numeric.array([1,0],'d')70 self.velocity = numpy.array([1,0],'d') 71 71 else: 72 self.velocity = Numeric.array(velocity,'d')72 self.velocity = numpy.array(velocity,'d') 73 73 74 74 #Only first is implemented for advection … … 155 155 156 156 import sys 157 from Numeric import zeros, Float158 157 from anuga.config import max_timestep 159 158 … … 228 227 229 228 import sys 230 from Numeric import zeros, Float231 229 from anuga.config import max_timestep 232 230 … … 251 249 stage_bdry = Stage.boundary_values 252 250 253 flux = zeros(1, Float) #Work array for summing up fluxes251 flux = numpy.zeros(1, numpy.float) #Work array for summing up fluxes 254 252 255 253 #Loop -
anuga_core/source_numpy_conversion/anuga/advection/advection_ext.c
r5162 r5908 10 10 11 11 #include "Python.h" 12 #include " Numeric/arrayobject.h"12 #include "numpy/arrayobject.h" 13 13 #include "math.h" 14 14 #include "stdio.h" -
anuga_core/source_numpy_conversion/anuga/advection/test_advection.py
r5242 r5908 6 6 7 7 from anuga.config import g, epsilon 8 from Numeric import allclose, array, zeros, ones, Float 8 import numpy 9 9 from anuga.advection.advection import Domain, Transmissive_boundary, Dirichlet_boundary 10 10 … … 48 48 49 49 #Populate boundary array with dirichlet conditions. 50 domain.neighbours = array([[-1,-2,-3]])50 domain.neighbours = numpy.array([[-1,-2,-3]]) 51 51 domain.quantities['stage'].boundary_values[:] = 1.0 52 52 … … 102 102 103 103 #Populate boundary array with dirichlet conditions. 104 domain.neighbours = array([[-1,-2,-3]])104 domain.neighbours = numpy.array([[-1,-2,-3]]) 105 105 domain.quantities['stage'].boundary_values[0] = 1.0 106 106 … … 111 111 domain.compute_fluxes() 112 112 U = domain.quantities['stage'].explicit_update 113 assert allclose(U, 0)113 assert numpy.allclose(U, 0) 114 114 115 115 … … 133 133 134 134 #Populate boundary array with dirichlet conditions. 135 domain.neighbours = array([[1,-1,-2], [0,-3,-4]])135 domain.neighbours = numpy.array([[1,-1,-2], [0,-3,-4]]) 136 136 domain.set_quantity('stage', [1.0, 0.0], location='centroids') 137 137 domain.distribute_to_vertices_and_edges() … … 157 157 #Boundaries 158 158 T = Transmissive_boundary(domain) 159 D = Dirichlet_boundary( array([3.1415]))159 D = Dirichlet_boundary(numpy.array([3.1415])) 160 160 161 161 domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} ) … … 164 164 #Check that the boundary value gets propagated to all elements 165 165 for t in domain.evolve(yieldstep = 0.05, finaltime = 10): 166 if allclose(domain.quantities['stage'].centroid_values, 3.1415):166 if numpy.allclose(domain.quantities['stage'].centroid_values, 3.1415): 167 167 break 168 168 169 assert allclose(domain.quantities['stage'].centroid_values, 3.1415)169 assert numpy.allclose(domain.quantities['stage'].centroid_values, 3.1415) 170 170 171 171
Note: See TracChangeset
for help on using the changeset viewer.