Changeset 6146 for anuga_core/source/anuga/advection
- Timestamp:
- Jan 13, 2009, 11:58:10 AM (16 years ago)
- Location:
- anuga_core/source/anuga/advection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/advection/advection.py
r5847 r6146 32 32 33 33 from anuga.abstract_2d_finite_volumes.domain import * 34 35 import Numeric as num 36 37 34 38 Generic_domain = Domain # Rename 35 39 … … 66 70 numproc=numproc) 67 71 68 import Numeric69 72 if velocity is None: 70 self.velocity = Numeric.array([1,0],'d')73 self.velocity = num.array([1,0],'d') 71 74 else: 72 self.velocity = Numeric.array(velocity,'d')75 self.velocity = num.array(velocity,'d') 73 76 74 77 #Only first is implemented for advection … … 155 158 156 159 import sys 157 from Numeric import zeros, Float158 160 from anuga.config import max_timestep 159 161 … … 228 230 229 231 import sys 230 from Numeric import zeros, Float231 232 from anuga.config import max_timestep 232 233 … … 251 252 stage_bdry = Stage.boundary_values 252 253 253 flux = zeros(1,Float) #Work array for summing up fluxes254 flux = num.zeros(1, num.Float) #Work array for summing up fluxes 254 255 255 256 #Loop -
anuga_core/source/anuga/advection/test_advection.py
r5242 r6146 6 6 7 7 from anuga.config import g, epsilon 8 from Numeric import allclose, array, zeros, ones, Float9 8 from anuga.advection.advection import Domain, Transmissive_boundary, Dirichlet_boundary 9 10 import Numeric as num 11 10 12 11 13 class Test_Advection(unittest.TestCase): … … 48 50 49 51 #Populate boundary array with dirichlet conditions. 50 domain.neighbours = array([[-1,-2,-3]])52 domain.neighbours = num.array([[-1,-2,-3]]) 51 53 domain.quantities['stage'].boundary_values[:] = 1.0 52 54 … … 102 104 103 105 #Populate boundary array with dirichlet conditions. 104 domain.neighbours = array([[-1,-2,-3]])106 domain.neighbours = num.array([[-1,-2,-3]]) 105 107 domain.quantities['stage'].boundary_values[0] = 1.0 106 108 … … 111 113 domain.compute_fluxes() 112 114 U = domain.quantities['stage'].explicit_update 113 assert allclose(U, 0)115 assert num.allclose(U, 0) 114 116 115 117 … … 133 135 134 136 #Populate boundary array with dirichlet conditions. 135 domain.neighbours = array([[1,-1,-2], [0,-3,-4]])137 domain.neighbours = num.array([[1,-1,-2], [0,-3,-4]]) 136 138 domain.set_quantity('stage', [1.0, 0.0], location='centroids') 137 139 domain.distribute_to_vertices_and_edges() … … 157 159 #Boundaries 158 160 T = Transmissive_boundary(domain) 159 D = Dirichlet_boundary( array([3.1415]))161 D = Dirichlet_boundary(num.array([3.1415])) 160 162 161 163 domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} ) … … 164 166 #Check that the boundary value gets propagated to all elements 165 167 for t in domain.evolve(yieldstep = 0.05, finaltime = 10): 166 if allclose(domain.quantities['stage'].centroid_values, 3.1415):168 if num.allclose(domain.quantities['stage'].centroid_values, 3.1415): 167 169 break 168 170 169 assert allclose(domain.quantities['stage'].centroid_values, 3.1415)171 assert num.allclose(domain.quantities['stage'].centroid_values, 3.1415) 170 172 171 173
Note: See TracChangeset
for help on using the changeset viewer.