Changeset 7824
- Timestamp:
- Jun 11, 2010, 7:45:03 PM (14 years ago)
- Location:
- anuga_work/development/pipeflow
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/pipeflow/test_sww_domain.py
r7823 r7824 40 40 domain.distribute_to_vertices_and_edges() 41 41 domain.compute_fluxes() 42 43 print domain.quantities['stage'].explicit_update44 print domain.quantities['xmomentum'].explicit_update45 46 print stage_ud47 print xmom_ud48 42 49 43 assert numpy.allclose( domain.quantities['stage'].explicit_update, stage_ud ) … … 125 119 126 120 for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime): 127 #pass121 pass 128 122 129 print domain.quantities['stage'].vertex_values130 print domain.quantities['elevation'].vertex_values131 print domain.quantities['xmomentum'].vertex_values132 133 134 print domain.quantities['stage'].centroid_values135 print domain.quantities['elevation'].centroid_values136 print domain.quantities['xmomentum'].centroid_values137 123 138 124 assert numpy.allclose( 10.0*numpy.ones(10), domain.quantities['stage'].centroid_values ) … … 161 147 pass 162 148 163 assert numpy.allclose( 10.0* ones(10), domain.quantities['stage'].centroid_values )164 assert numpy.allclose( zeros(10), domain.quantities['xmomentum'].centroid_values )149 assert numpy.allclose( 10.0*numpy.ones(10), domain.quantities['stage'].centroid_values ) 150 assert numpy.allclose( numpy.zeros(10), domain.quantities['xmomentum'].centroid_values ) 165 151 166 152 def test_evolve_second_order_space_time(self): … … 186 172 pass 187 173 188 assert numpy.allclose( 10.0* ones(10), domain.quantities['stage'].centroid_values )189 assert numpy.allclose( zeros(10), domain.quantities['xmomentum'].centroid_values )174 assert numpy.allclose( 10.0*numpy.ones(10), domain.quantities['stage'].centroid_values ) 175 assert numpy.allclose( numpy.zeros(10), domain.quantities['xmomentum'].centroid_values ) 190 176 191 177 -
anuga_work/development/pipeflow/test_sww_vel_domain.py
r7823 r7824 5 5 6 6 7 from shallow_water_vel_domain import * 8 9 10 from Numeric import allclose, array, ones, Float, maximum, zeros 7 from sww_vel_domain import * 8 9 10 from numpy import allclose, array, ones, maximum, zeros 11 import numpy 11 12 12 13 … … 110 111 domain.update_boundary() 111 112 112 stage_ud, xmom_ud = local_compute_fluxes(domain) 113 import sww_python 114 stage_ud, xmom_ud = sww_python.compute_fluxes(domain) 113 115 114 116 domain.compute_fluxes() … … 126 128 # print domain.quantities['velocity'].boundary_values 127 129 128 print domain.quantities['stage'].explicit_update129 print domain.quantities['xmomentum'].explicit_update130 131 print stage_ud132 print xmom_ud133 130 134 131 assert allclose( domain.quantities['stage'].explicit_update, stage_ud ) … … 138 135 def test_local_flux_function(self): 139 136 normal = 1.0 140 ql = array([1.0, 2.0], Float)141 qr = array([1.0, 2.0], Float)137 ql = array([1.0, 2.0],numpy.float) 138 qr = array([1.0, 2.0],numpy.float) 142 139 zl = 0.0 143 140 zr = 0.0 144 141 145 142 #This assumes h0 = 1.0e-3!! 146 edgeflux, maxspeed = local_flux_function(normal, ql,qr,zl,zr) 143 import sww_python 144 edgeflux, maxspeed = sww_python.flux_function(normal, ql,qr,zl,zr) 147 145 #print maxspeed 148 146 #print edgeflux 149 147 150 assert allclose( array([2.0, 8.9],Float), edgeflux, rtol=1.0e-005)148 assert allclose([2.0, 8.9], edgeflux, rtol=1.0e-005) 151 149 assert allclose(5.1305, maxspeed, rtol=1.0e-005) 152 150 153 151 normal = -1.0 154 ql = array([1.0, 2.0], Float)155 qr = array([1.0, 2.0], Float)152 ql = array([1.0, 2.0],numpy.float) 153 qr = array([1.0, 2.0],numpy.float) 156 154 zl = 0.0 157 155 zr = 0.0 158 156 159 edgeflux, maxspeed = local_flux_function(normal, ql,qr,zl,zr)157 edgeflux, maxspeed = sww_python.flux_function(normal, ql,qr,zl,zr) 160 158 161 159 … … 163 161 #print edgeflux 164 162 165 assert allclose( array([-2.0, -8.9],Float), edgeflux, rtol=1.0e-005)163 assert allclose([-2.0, -8.9], edgeflux, rtol=1.0e-005) 166 164 assert allclose(5.1305, maxspeed, rtol=1.0e-005) 167 165 … … 189 187 #print domain.quantities['xmomentum'].explicit_update 190 188 191 assert allclose( array([-34.3, -24.5, -14.7], Float), domain.quantities['xmomentum'].explicit_update )189 assert allclose( [-34.3, -24.5, -14.7], domain.quantities['xmomentum'].explicit_update ) 192 190 193 191
Note: See TracChangeset
for help on using the changeset viewer.