Changeset 2635
- Timestamp:
- Mar 30, 2006, 12:53:55 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/examples/island.py
r2632 r2635 16 16 # Application specific imports 17 17 from pyvolution.mesh_factory import rectangular 18 from pyvolution.shallow_water import Domain, Reflective_boundary 18 from pyvolution.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary 19 19 from pmesh.mesh_interface import create_mesh_from_regions 20 20 from utilities.polygon import Polygon_function, read_polygon 21 21 22 from pyvolution.quantity import Quantity 23 from Numeric import allclose 22 24 23 25 #------------------------------------------------------------------------------ … … 36 38 'left': [3]}, 37 39 maximum_triangle_area = 25, 38 filename = 'island.msh', 39 interior_regions=[ ([[50,25], [70,25], 40 [70,75], [50,75]], 3)] 40 filename = 'island.msh' 41 , interior_regions=[ ([[50,25], [70,25], [70,75], [50,75]], 1)] 41 42 ) 42 43 … … 71 72 for i in range(len(x)): 72 73 z[i] = 8*exp( -((x[i]-50)**2 + (y[i]-50)**2)/100 ) 74 75 #z[i] += 0.5*exp( -((x[i]-10)**2 + (y[i]-10)**2)/50 ) 76 73 77 return z 74 78 75 domain.set_quantity('friction', 2.0) 79 def slump(x, y): 80 z = 0*x 81 for i in range(len(x)): 82 z[i] -= 0.7*exp( -((x[i]-10)**2 + (y[i]-10)**2)/200 ) 83 84 return z 85 86 domain.set_quantity('friction', 0.0) 76 87 domain.set_quantity('elevation', island) 77 88 domain.set_quantity('stage', 1) … … 83 94 84 95 Br = Reflective_boundary(domain) 96 Bd = Dirichlet_boundary([1, 0, 0]) 85 97 86 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 98 #domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 99 domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd}) 87 100 domain.check_integrity() 88 101 … … 93 106 94 107 import time 95 for t in domain.evolve(yieldstep = 1, finaltime = 100):108 for t in domain.evolve(yieldstep = 1, finaltime = 500): 96 109 domain.write_time() 97 #for t in domain.evolve(yieldstep = 0.05, finaltime = 5): 98 # domain.write_time() 99 # #print ' Volume: ', domain.get_quantity('stage').get_integral() 110 if allclose(t, 100): 111 Q = domain.get_quantity('stage') 112 Q_s = Quantity(domain) 113 Q_s.set_values(slump) 114 domain.set_quantity('stage', Q + Q_s) 115 #print ' Volume: ', domain.get_quantity('stage').get_integral() 100 116 101 117 print 'Done' -
inundation/examples/island_timeseries.py
r2632 r2635 11 11 swwfile = 'island.sww' 12 12 #gauges = [[56, 48], [58, 48], [60, 48], [62, 48], [64, 48]] 13 gauges = [[60, 48], [62, 48], [64, 48]] 13 #gauges = [[10, 10], [60, 48], [62, 48], [64, 48]] 14 gauges = [[10, 10], [40, 10], [70, 10]] 14 15 15 16 16 store = False17 store = True 17 18 18 19 #Read model output … … 104 105 hold(False) 105 106 106 if elevations[0] < 0:107 if elevations[0] <= 0: 107 108 plot(model_time, stages, '-b') 108 109 else: -
inundation/pyvolution/shallow_water_ext.c
r2632 r2635 374 374 375 375 //Old code: Set momentum to zero and ensure h is non negative 376 /* 377 xmomc[k] = 0.0; 378 ymomc[k] = 0.0; 379 //wc[k] = zc[k]; 380 if (hc <= 0.0) wc[k] = zc[k]; 381 */ 376 //xmomc[k] = 0.0; 377 //ymomc[k] = 0.0; 378 //if (hc <= 0.0) wc[k] = zc[k]; 379 382 380 383 381 //New code: Adjust momentum to guarantee speeds are physical 384 382 // ensure h is non negative 385 383 384 386 385 if (hc <= 0.0) { 387 386 wc[k] = zc[k]; … … 390 389 } else { 391 390 //Reduce excessive speeds derived from division by small hc 392 //FIXME (Ole): This has not been written in Python393 391 u = xmomc[k]/hc; 394 392 if (fabs(u) > maximum_allowed_speed) {
Note: See TracChangeset
for help on using the changeset viewer.