- Timestamp:
- May 24, 2008, 11:55:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5358 r5361 6289 6289 6290 6290 def test_urs2sts(self): 6291 """tide = 16292 time_step_count = 36293 time_step = 26294 lat_long = [[-21.5,114.5],[-21,114.5],[-21,115]]6295 depth=206296 ha=26297 ua=56298 va=-10 #-ve added to take into account mux file format where south6299 # is positive.6300 """6301 #tide = 16302 6291 tide=0 6303 6292 time_step_count = 3 … … 6407 6396 self.delete_mux(files) 6408 6397 os.remove(sts_file) 6398 6399 def test_file_boundary_sts(self): 6400 from anuga.shallow_water import Domain 6401 from anuga.shallow_water import Reflective_boundary 6402 from anuga.shallow_water import Dirichlet_boundary 6403 from anuga.shallow_water import File_boundary 6404 from anuga.pmesh.mesh_interface import create_mesh_from_regions 6405 from anuga.abstract_2d_finite_volumes.pmesh2domain import pmesh_to_domain_instance 6406 bounding_polygon=[[6.0,97.0],[6.01,97.0],[6.02,97.0],[6.02,97.02],[6.00,97.02]] 6407 tide=0. 6408 time_step_count = 5 6409 time_step = 2 6410 lat_long_points =bounding_polygon[0:3] 6411 n=len(lat_long_points) 6412 first_tstep=ones(n,Int) 6413 last_tstep=(time_step_count)*ones(n,Int) 6414 gauge_depth=20*ones(n,Float) 6415 ha=2*ones((n,time_step_count),Float) 6416 ua=10*ones((n,time_step_count),Float) 6417 va=-10*ones((n,time_step_count),Float) 6418 base_name, files = self.write_mux2(lat_long_points, 6419 time_step_count, time_step, 6420 first_tstep, last_tstep, 6421 depth=gauge_depth, 6422 ha=ha, 6423 ua=ua, 6424 va=va) 6425 6426 sts_file=base_name 6427 urs2sts(base_name,sts_file,mean_stage=tide,verbose=False) 6428 self.delete_mux(files) 6429 6430 #print 'start create mesh from regions' 6431 for i in range(len(bounding_polygon)): 6432 zone,bounding_polygon[i][0],bounding_polygon[i][1]=redfearn(bounding_polygon[i][0],bounding_polygon[i][1]) 6433 extent_res=1000000 6434 meshname = 'urs_test_mesh' + '.tsh' 6435 interior_regions=None 6436 boundary_tags={'ocean': [0,1], 'otherocean': [2,3,4]} 6437 create_mesh_from_regions(bounding_polygon,boundary_tags=boundary_tags, 6438 maximum_triangle_area=extent_res,filename=meshname, 6439 interior_regions=interior_regions,verbose=False) 6440 6441 domain_fbound = pmesh_to_domain_instance(meshname, Domain) 6442 domain_fbound.set_quantity('stage', tide) 6443 Bf = File_boundary(sts_file+'.sts', domain_fbound) 6444 Br = Reflective_boundary(domain_fbound) 6445 Bd=Dirichlet_boundary([2.0,220,-220]) 6446 domain_fbound.set_boundary({'ocean': Bf,'otherocean': Br}) 6447 finaltime=time_step*(time_step_count-1) 6448 yieldstep=time_step 6449 temp_fbound=zeros(int(finaltime/yieldstep)+1,Float) 6450 i=0 6451 for t in domain_fbound.evolve(yieldstep=yieldstep,finaltime=finaltime, 6452 skip_initial_step = False): 6453 temp_fbound[i]=domain_fbound.quantities['stage'].centroid_values[2] 6454 i+=1 6455 6456 domain_drchlt = pmesh_to_domain_instance(meshname, Domain) 6457 domain_drchlt.set_quantity('stage', tide) 6458 Br = Reflective_boundary(domain_drchlt) 6459 Bd=Dirichlet_boundary([2.0,220,-220]) 6460 domain_drchlt.set_boundary({'ocean': Bd,'otherocean': Br}) 6461 temp_drchlt=zeros(int(finaltime/yieldstep)+1,Float) 6462 i=0 6463 for t in domain_drchlt.evolve(yieldstep=yieldstep,finaltime=finaltime, 6464 skip_initial_step = False): 6465 temp_drchlt[i]=domain_drchlt.quantities['stage'].centroid_values[2] 6466 i+=1 6467 6468 assert temp_fbound-temp_drchlt<epsilon 6469 os.remove(sts_file+'.sts') 6470 os.remove(meshname) 6409 6471 6410 6472 def test_lon_lat2grid(self):
Note: See TracChangeset
for help on using the changeset viewer.