Changeset 845
- Timestamp:
- Feb 8, 2005, 1:00:25 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r778 r845 716 716 717 717 ############################################### 718 #Boundar y- specific to the shallow water wave equation718 #Boundaries - specific to the shallow water wave equation 719 719 class Reflective_boundary(Boundary): 720 720 """Reflective boundary returns same conserved quantities as … … 765 765 return q 766 766 767 768 class Spatio_temporal_boundary(Boundary): 769 """The spatio-temporal boundary, reads values for the conserved 770 quantities from an sww NetCDF file, and returns interpolated values 771 at the midpoints of each associated boundaty segment. 772 Time dependency is interpolated linearly as in util.File_function. 773 774 """ 775 776 pass 777 767 778 768 779 ######################### -
inundation/ga/storm_surge/pyvolution/test_shallow_water.py
r773 r845 2372 2372 2373 2373 2374 2374 2375 def test_spatio_temporal_boundary(self): 2376 """Test that boundary values can be read from file and interpolated 2377 in both time and space 2378 """ 2379 import time 2380 2381 #Create sww file of simple propagation from left to right 2382 #through rectangular domain: domain1 2383 2384 from mesh_factory import rectangular 2385 2386 #Create basic mesh 2387 points, vertices, boundary = rectangular(3, 3) 2388 2389 #Create shallow water domain 2390 domain = Domain(points, vertices, boundary) 2391 domain.smooth = False 2392 2393 domain.visualise = False 2394 domain.default_order = 2 2395 2396 domain.set_datadir('.') 2397 domain.store = True 2398 domain.set_name('test_spatio_temporal_boundary_' + str(time.time())) 2399 2400 #Bed-slope and friction at vertices (and interpolated elsewhere) 2401 domain.set_quantity('elevation', 0) 2402 domain.set_quantity('friction', 0) 2403 2404 # Boundary conditions 2405 Br = Reflective_boundary(domain) 2406 Bd = Dirichlet_boundary([0.3,0,0]) 2407 Bt = Transmissive_boundary(domain) 2408 domain.set_boundary({'left': Bd, 'right': Bt, 'top': Br, 'bottom': Br}) 2409 2410 #Initial condition 2411 domain.set_quantity('stage', 0) 2412 domain.check_integrity() 2413 2414 #Evolution 2415 for t in domain.evolve(yieldstep = 0.05, finaltime = 4): 2416 import time 2417 #time.sleep(0.01) 2418 #domain.write_time() 2419 2420 2421 2422 2423 2424 #Create an triangle shaped domain, formed from the 2425 #lower and right hand boundaries and the sw-ne diagonal 2426 #from domain 1. Called it domain2 2427 2428 #Use output from domain1 as spatio-temporal boundary for domain2 2429 #and verify that results at right hand side are close. 2430 2431 2432 2375 2433 2376 2434 #-------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.