Changeset 2852 for inundation/pyvolution
- Timestamp:
- May 11, 2006, 5:17:22 PM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r2750 r2852 239 239 from Numeric import Int, Float, Float32 240 240 241 self.precision = Float32 #Use single precision 241 self.precision = Float32 #Use single precision for quantities 242 242 if hasattr(domain, 'max_size'): 243 243 self.max_size = domain.max_size #file size max is 2Gig … … 301 301 'number_of_vertices')) 302 302 303 fid.createVariable('time', self.precision, 303 fid.createVariable('time', Float, # Always use full precision lest two timesteps 304 # close to each other may appear as the same step 304 305 ('number_of_timesteps',)) 305 306 -
inundation/pyvolution/domain.py
r2851 r2852 697 697 if self.time > finaltime: 698 698 #FIXME (Ole, 30 April 2006): Do we need this check? 699 print 'WARNING (domain.py): time overshot finaltime '699 print 'WARNING (domain.py): time overshot finaltime. Contact Ole.Nielsen@ga.gov.au' 700 700 self.time = finaltime 701 701 702 702 # Yield final time and stop 703 #print 'finaltime %.18f' %self.time704 703 yield(self.time) 705 704 break … … 714 713 715 714 #Pass control on to outer loop for more specific actions 716 #print 'yieldtime %.18f' %self.time717 715 yield(self.time) 718 719 #if finaltime is not None and self.time >= finaltime:720 if finaltime is not None and abs(self.time - finaltime) < epsilon:721 # FIXME (Ole, 30 April 2006): Maybe this will remove722 # duplicate final timesteps?723 # What we really need is to go back to conditions like724 # if finaltime is not None and self.time >= finaltime:725 # as above and then understand fully726 # the two tests that break as a consequence727 break728 716 729 717 # Reinitialise … … 733 721 self.number_of_steps = 0 734 722 self.number_of_first_order_steps = 0 735 723 736 724 737 725 def evolve_to_end(self, finaltime = 1.0): -
inundation/pyvolution/test_util.py
r2783 r2852 104 104 105 105 106 def test_spatio_temporal_file_function (self):106 def test_spatio_temporal_file_function_basic(self): 107 107 """Test that spatio temporal file function performs the correct 108 108 interpolations in both time and space … … 147 147 t0 = -1 148 148 for t in domain1.evolve(yieldstep = 0.1, finaltime = finaltime): 149 #print 'Timesteps: % f, %f' %(t0, t)149 #print 'Timesteps: %.16f, %.16f' %(t0, t) 150 150 #if t == t0: 151 151 # msg = 'Duplicate timestep found: %f, %f' %(t0, t) … … 171 171 #Diagonal is identified by vertices: 0, 5, 10, 15 172 172 173 timestep = len(time)-1 #Last timestep174 d_stage = reshape(take(stage[ timestep, :], [0,5,10,15]), (4,1))175 d_uh = reshape(take(xmomentum[ timestep, :], [0,5,10,15]), (4,1))176 d_vh = reshape(take(ymomentum[ timestep, :], [0,5,10,15]), (4,1))173 last_time_index = len(time)-1 #Last last_time_index 174 d_stage = reshape(take(stage[last_time_index, :], [0,5,10,15]), (4,1)) 175 d_uh = reshape(take(xmomentum[last_time_index, :], [0,5,10,15]), (4,1)) 176 d_vh = reshape(take(ymomentum[last_time_index, :], [0,5,10,15]), (4,1)) 177 177 D = concatenate( (d_stage, d_uh, d_vh), axis=1) 178 178 … … 195 195 interpolation_points = d_midpoints) 196 196 197 q = f(timestep/10., point_id=0); assert allclose(r0, q) 198 q = f(timestep/10., point_id=1); assert allclose(r1, q) 199 q = f(timestep/10., point_id=2); assert allclose(r2, q) 197 msg = 'duplicate timesteps: %.16f and %.16f' %(f.T[-1], f.T[-2]) 198 assert not f.T[-1] == f.T[-2], msg 199 t = time[last_time_index] 200 q = f(t, point_id=0); assert allclose(r0, q) 201 q = f(t, point_id=1); assert allclose(r1, q) 202 q = f(t, point_id=2); assert allclose(r2, q) 200 203 201 204 … … 371 374 #Diagonal is identified by vertices: 0, 5, 10, 15 372 375 373 timestep = len(time)-1 #Last timestep374 d_stage = reshape(take(stage[ timestep, :], [0,5,10,15]), (4,1))375 d_uh = reshape(take(xmomentum[ timestep, :], [0,5,10,15]), (4,1))376 d_vh = reshape(take(ymomentum[ timestep, :], [0,5,10,15]), (4,1))376 last_time_index = len(time)-1 #Last last_time_index 377 d_stage = reshape(take(stage[last_time_index, :], [0,5,10,15]), (4,1)) 378 d_uh = reshape(take(xmomentum[last_time_index, :], [0,5,10,15]), (4,1)) 379 d_vh = reshape(take(ymomentum[last_time_index, :], [0,5,10,15]), (4,1)) 377 380 D = concatenate( (d_stage, d_uh, d_vh), axis=1) 378 381 … … 400 403 interpolation_points = d_midpoints) 401 404 402 q = f(timestep/10., point_id=0); assert allclose(r0, q) 403 q = f(timestep/10., point_id=1); assert allclose(r1, q) 404 q = f(timestep/10., point_id=2); assert allclose(r2, q) 405 t = time[last_time_index] 406 q = f(t, point_id=0); assert allclose(r0, q) 407 q = f(t, point_id=1); assert allclose(r1, q) 408 q = f(t, point_id=2); assert allclose(r2, q) 405 409 406 410
Note: See TracChangeset
for help on using the changeset viewer.